Skip to content

PDF export

Giorgio Garofalo edited this page Jul 16, 2025 · 10 revisions

When running Quarkdown's compiler via quarkdown c, specifying the --pdf flag generates a PDF file.

  • The content of the PDF matches 1:1 with what the HTML output would render in the Chrome browser.
  • All document types and features supported by the HTML target are also supported.

Requirements

In order to generate PDF files from HTML, the following dependencies are required:

  • Node.js
  • npm (usually bundled with Node.js)
  • Puppeteer (npm install puppeteer --prefix <quarkdown_dir>/lib)

Dependencies are already taken care of by package managers and install scripts.

Additional options

  • --node-path <path>: sets the path to the Node.js executable. Defaults to node.

  • --npm-path <path>: sets the path to the npm executable. Defaults to npm.

  • --pdf-no-sandbox: disables Chrome sandbox during PDF generation. This is potentially unsafe and should be used only when strictly needed. For instance, some Linux distributions don't support headless sandbox.

Environment variables

  • QD_NPM_PREFIX: directory where node_modules should be found. Defaults to lib if Quarkdown was installed via a package manager or install script.

Exporting manually (legacy way)

An HTML artifact can be exported to PDF via the in-browser print feature (CTRL/CMD + P).

While paged (and plain) documents are print-ready, you'll need a few additional steps to save your slides document as PDF.
Please refer to Reveal's instructions to learn how to do so.

Clone this wiki locally