What command line options does wkhtmltopdf support?

Updated

wkhtmltopdf supports a large set of command line options, and the site points you to the auto-generated wkhtmltopdf manual for the full list. Options are how you control the output beyond a basic conversion — for example, adding a table of contents to the PDF. The exact, complete option list lives in that manual rather than on the homepage, so treat the manual as the authoritative reference.

How options fit into the basic workflow

The tool is a command line program, so options are passed alongside the input and output arguments. The documented flow is:

  1. Download a precompiled binary or build from source.
  2. Create the HTML document you want to turn into a PDF (or image).
  3. Run your HTML document through the tool.

The site's own example is a plain conversion with no extra options:

wkhtmltopdf http://google.com google.pdf

Here the input is a URL and the output is google.pdf. Options are what you add to change how that PDF is produced — the site's illustration of this is wanting a table of contents in addition to the converted page.

What the options are for

According to the site, "There are plenty of command line options," and they exist to adjust the PDF or image generation. The one concrete example given is adding a table of contents. Beyond that, the homepage does not enumerate individual flags — it directs you to the auto-generated manual for the complete set.

Aspect What the site states
Where options are documented The auto-generated wkhtmltopdf manual
Example use of an option Adding a table of contents
Scope "Plenty" of options for adjusting output
Applies to Both PDF and image generation

Where to find the full option list

The homepage does not list every flag. To see the complete set of supported options, consult the auto-generated wkhtmltopdf manual linked from the site. That manual is the place to check when you need a specific option rather than the one table-of-contents example.

Related capabilities worth knowing

  • Image output: wkhtmltoimage handles image formats, alongside wkhtmltopdf for PDF.
  • Headless operation: Both run entirely headless and do not require a display or display service.
  • C library: A C library is available if you prefer to work programmatically instead of via the command line, with its own library documentation.
  • Real-world uses: The site suggests invoices, birthday cards, and similar documents as examples.

If your goal is simply converting a page or file, the basic command above is enough. If you need to shape the output — such as inserting a table of contents — go to the auto-generated manual and add the relevant options to the command.