wkhtmltopdf: What paper sizes are valid?
Asked Answered
A

3

12

I am using wkhtmltopdf(html to pdf converter) and am running it through a php shell_exec.

When running wkhtmltopdf --help one option is size, with the help text being

Set paper size to: A4, Letter, etc.

I am wondering if someone has a list of paper sizes this executable will run?

The specific version is wkhtmltopdf-0.9.9-static-i386

Abirritant answered 18/6, 2011 at 8:48 Comment(1)
Related: How to convert HTML into endless one-page PDF via wkhtmltopdf? at SUBossuet
P
36

If you take a look through the pdfsettings.cc source in the project repository, you'll find this list, which looks to me like the accepted list of named paper sizes.

res["A0"] = QPrinter::A0;
res["A1"] = QPrinter::A1;
res["A2"] = QPrinter::A2;
res["A3"] = QPrinter::A3;
res["A4"] = QPrinter::A4;
res["A5"] = QPrinter::A5;
res["A6"] = QPrinter::A6;
res["A7"] = QPrinter::A7;
res["A8"] = QPrinter::A8;
res["A9"] = QPrinter::A9;
res["B0"] = QPrinter::B0;
res["B1"] = QPrinter::B1;
res["B10"] = QPrinter::B10;
res["B2"] = QPrinter::B2;
res["B3"] = QPrinter::B3;
res["B4"] = QPrinter::B4;
res["B5"] = QPrinter::B5;
res["B6"] = QPrinter::B6;
res["B7"] = QPrinter::B7;
res["B8"] = QPrinter::B8;
res["B9"] = QPrinter::B9;
res["C5E"] = QPrinter::C5E;
res["Comm10E"] = QPrinter::Comm10E;
res["DLE"] = QPrinter::DLE;
res["Executive"] = QPrinter::Executive;
res["Folio"] = QPrinter::Folio;
res["Ledger"] = QPrinter::Ledger;
res["Legal"] = QPrinter::Legal;
res["Letter"] = QPrinter::Letter;
res["Tabloid"] = QPrinter::Tabloid;
Protasis answered 18/6, 2011 at 9:17 Comment(2)
I was hoping there would be some unlimited height option.Bossuet
@Bossuet and also unlimited height paper and printer :)Unreserve
A
2

I tried the following, they worked for me:

  1. Legal
  2. Letter
  3. Tabloid
  4. A4
  5. A3
  6. B5
  7. B4
  8. B3
Alcinia answered 18/6, 2011 at 9:2 Comment(0)
H
0

You can see a list of supported page sizes at https://doc.qt.io/archives/qt-4.8/qprinter.html#PaperSize-enum

A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,B0,B1,B2,B3,B4,B5,B6,B7,B8,B9,B10,C5E,Comm10E,DLE,Executive,Folio,Ledger,Legal,Letter,Tabloid,Custom

Note "custom" at the end of the list. You can specify --page-width size and --page-height size with size being 1in, 3mm, 5cm, etc

Hahn answered 11/8, 2023 at 0:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.