Skip to content

[FR] Rethink the way to output PDF from any format.  #7039

@cderv

Description

@cderv

Pandoc does have a simple way to print PDF (https://pandoc.org/MANUAL.html#creating-a-pdf)

To produce a PDF, specify an output file with a .pdf extension:

--pdf-engine controls the behavior. Default is to look at the output format, a specific method will be used.

  • -t latex or none: pdflatex (other options: xelatex, lualatex, tectonic, latexmk)
  • -t context: context
  • -t html: wkhtmltopdf (other options: prince, weasyprint, pagedjs-cli; see print-css.rocks for a good introduction to PDF generation from HTML/CSS)
  • -t ms: pdfroff
  • -t typst: typst

Quarto does not really work that way - this currently limit the way to create a PDF, and this is not really consistent across format.

In Quarto we support format: pdf which assumes LaTeX or ConTeXt enine. And format: typst which will produce PDF file by default.

There is special output-ext that can modify PDF render. output-ext: tex when format: pdf renders a .tex file. And output-ext: typ when format: typst render a .typ file. But this variable output-ext is fragile (try setting output-ext to anything it will not error)

When typst was introduced, format: typst has been created but default to render a PDF file. output-ext can be use to get the .typ.

HTML printing to PDF is not really supported in Quarto (#222).

Using format: latex does not exactly work the same as format: typst as it won't produce PDF.

We should probably rethink all this, and offer more mechanism to create PDF according to method available like Pandoc allows

  • Easy and robust way to opt-out PDF for a format that default to it
  • Allow printing to PDF from HTML using an external pdf-engine that supports that.
  • Consistent way to produce PDF from Quarto render; or another quarto command (e.g quarto print)

Related Issues / Discussions

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicAn issue that contains other issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions