QPageSize Class
The QPageSize class describes the size and name of a defined page size. More...
| Header: | #include <QPageSize> |
| qmake: | QT += gui |
| Since: | Qt 5.3 |
This class was introduced in Qt 5.3.
Public Types
| enum | PageSizeId { A0, A1, A2, A3, A4, …, LastPageSize } |
| enum | SizeMatchPolicy { FuzzyMatch, FuzzyOrientationMatch, ExactMatch } |
| enum | Unit { Millimeter, Point, Inch, Pica, Didot, Cicero } |
Detailed Description
This class implements support for the set of standard page sizes as defined in the Adobe Postscript PPD Standard v4.3. It defines the standard set of page sizes in points, millimeters and inches and ensures these sizes are consistently used. Other size units can be used but will be calculated results and so may not always be consistent. The defined point sizes are always a integer, all other sizes can be fractions of a unit.
The defined size is always in width x height order with no implied page orientation. Note that it is possible for page sizes to be defined where the width is greater than the height, such as QPageSize::Ledger, so you cannot rely on comparing the width and height values to determine page orientation.
For example, A4 is defined by the standard as 210mm x 297mm, 8.27in x 11.69in, or 595pt x 842pt.
You can also define custom page sizes with custom names in any units you want and this unit size will be preserved and used as the base for all other unit size calculations.
When creating a QPageSize using a custom QSize you can choose if you want QPageSize to try match the size to a standard page size. By default QPaperSize uses a FuzzyMatch mode where it will match a given page size to a standard page size if it falls within 3 postscript points of a defined standard size. You can override this to request only an exact match but this is not recommended as conversions between units can easily lose 3 points and result in incorrect page sizes.
A QPageSize instance may also be obtained by querying the supported page sizes for a print device. In this case the localized name returned is that defined by the printer itself. Note that the print device may not support the current default locale language.
The class also provides convenience methods for converting page size IDs to and from various unit sizes.
See also QPagedPaintDevice and QPdfWriter.
Member Type Documentation
enum QPageSize::PageSizeId
This enum type lists the available page sizes as defined in the Postscript PPD standard. These values are duplicated in QPagedPaintDevice and QPrinter.
The defined sizes are:
| Constant | Value | Description |
|---|---|---|
QPageSize::A0 | 5 | 841 x 1189 mm |
QPageSize::A1 | 6 | 594 x 841 mm |
QPageSize::A2 | 7 | 420 x 594 mm |
QPageSize::A3 | 8 | 297 x 420 mm |
QPageSize::A4 | 0 | 210 x 297 mm, 8.26 x 11.69 inches |
QPageSize::A5 | 9 | 148 x 210 mm |
QPageSize::A6 | 10 | 105 x 148 mm |
QPageSize::A7 | 11 | 74 x 105 mm |
QPageSize::A8 | 12 | 52 x 74 mm |
QPageSize::A9 | 13 | 37 x 52 mm |
QPageSize::B0 | 14 | 1000 x 1414 mm |
QPageSize::B1 | 15 | 707 x 1000 mm |
QPageSize::B2 | 17 | 500 x 707 mm |
QPageSize::B3 | 18 | 353 x 500 mm |
QPageSize::B4 | 19 | 250 x 353 mm |
QPageSize::B5 | 1 | 176 x 250 mm, 6.93 x 9.84 inches |
QPageSize::B6 | 20 | 125 x 176 mm |
QPageSize::B7 | 21 | 88 x 125 mm |
QPageSize::B8 | 22 | 62 x 88 mm |
QPageSize::B9 | 23 | 44 x 62 mm |
QPageSize::B10 | 16 | 31 x 44 mm |
QPageSize::C5E | 24 | 163 x 229 mm |
QPageSize::Comm10E | 25 | 105 x 241 mm, U.S. Common 10 Envelope |
QPageSize::DLE | 26 | 110 x 220 mm |
QPageSize::Executive | 4 | 7.5 x 10 inches, 190.5 x 254 mm |
QPageSize::Folio | 27 | 210 x 330 mm |
QPageSize::Ledger | 28 | 431.8 x 279.4 mm |
QPageSize::Legal | 3 | 8.5 x 14 inches, 215.9 x 355.6 mm |
QPageSize::Letter | 2 | 8.5 x 11 inches, 215.9 x 279.4 mm |
QPageSize::Tabloid | 29 | 279.4 x 431.8 mm |
QPageSize::Custom | 30 | Unknown, or a user defined size. |
QPageSize::A10 | 31 | |
QPageSize::A3Extra | 32 | |
QPageSize::A4Extra | 33 | |
QPageSize::A4Plus | 34 | |
QPageSize::A4Small | 35 | |
QPageSize::A5Extra | 36 | |
QPageSize::B5Extra | 37 | |
QPageSize::JisB0 | 38 | |
QPageSize::JisB1 | 39 | |
QPageSize::JisB2 | 40 | |
QPageSize::JisB3 | 41 | |
QPageSize::JisB4 | 42 | |
QPageSize::JisB5 | 43 | |
QPageSize::JisB6 | 44 | , |
QPageSize::JisB7 | 45 | |
QPageSize::JisB8 | 46 | |
QPageSize::JisB9 | 47 | |
QPageSize::JisB10 | 48 | |
QPageSize::AnsiA | Letter | = Letter |
QPageSize::AnsiB | Ledger | = Ledger |
QPageSize::AnsiC | 49 | |
QPageSize::AnsiD | 50 | |
QPageSize::AnsiE | 51 | |
QPageSize::LegalExtra | 52 | |
QPageSize::LetterExtra | 53 | |
QPageSize::LetterPlus | 54 | |
QPageSize::LetterSmall | 55 | |
QPageSize::TabloidExtra | 56 | |
QPageSize::ArchA | 57 | |
QPageSize::ArchB | 58 | |
QPageSize::ArchC | 59 | |
QPageSize::ArchD | 60 | |
QPageSize::ArchE | 61 | |
QPageSize::Imperial7x9 | 62 | |
QPageSize::Imperial8x10 | 63 | |
QPageSize::Imperial9x11 | 64 | |
QPageSize::Imperial9x12 | 65 | |
QPageSize::Imperial10x11 | 66 | |
QPageSize::Imperial10x13 | 67 | |
QPageSize::Imperial10x14 | 68 | |
QPageSize::Imperial12x11 | 69 | |
QPageSize::Imperial15x11 | 70 | |
QPageSize::ExecutiveStandard | 71 | |
QPageSize::Note | 72 | |
QPageSize::Quarto | 73 | |
QPageSize::Statement | 74 | |
QPageSize::SuperA | 75 | |
QPageSize::SuperB | 76 | |
QPageSize::Postcard | 77 | |
QPageSize::DoublePostcard | 78 | |
QPageSize::Prc16K | 79 | |
QPageSize::Prc32K | 80 | |
QPageSize::Prc32KBig | 81 | |
QPageSize::FanFoldUS | 82 | |
QPageSize::FanFoldGerman | 83 | |
QPageSize::FanFoldGermanLegal | 84 | |
QPageSize::EnvelopeB4 | 85 | |
QPageSize::EnvelopeB5 | 86 | |
QPageSize::EnvelopeB6 | 87 | |
QPageSize::EnvelopeC0 | 88 | |
QPageSize::EnvelopeC1 | 89 | |
QPageSize::EnvelopeC2 | 90 | |
QPageSize::EnvelopeC3 | 91 | |
QPageSize::EnvelopeC4 | 92 | |
QPageSize::EnvelopeC5 | C5E | = C5E |
QPageSize::EnvelopeC6 | 93 | |
QPageSize::EnvelopeC65 | 94 | |
QPageSize::EnvelopeC7 | 95 | |
QPageSize::EnvelopeDL | DLE | = DLE |
QPageSize::Envelope9 | 96 | |
QPageSize::Envelope10 | Comm10E | = Comm10E |
QPageSize::Envelope11 | 97 | |
QPageSize::Envelope12 | 98 | |
QPageSize::Envelope14 | 99 | |
QPageSize::EnvelopeMonarch | 100 | |
QPageSize::EnvelopePersonal | 101 | |
QPageSize::EnvelopeChou3 | 102 | |
QPageSize::EnvelopeChou4 | 103 | |
QPageSize::EnvelopeInvite | 104 | |
QPageSize::EnvelopeItalian | 105 | |
QPageSize::EnvelopeKaku2 | 106 | |
QPageSize::EnvelopeKaku3 | 107 | |
QPageSize::EnvelopePrc1 | 108 | |
QPageSize::EnvelopePrc2 | 109 | |
QPageSize::EnvelopePrc3 | 110 | |
QPageSize::EnvelopePrc4 | 111 | |
QPageSize::EnvelopePrc5 | 112 | |
QPageSize::EnvelopePrc6 | 113 | |
QPageSize::EnvelopePrc7 | 114 | |
QPageSize::EnvelopePrc8 | 115 | |
QPageSize::EnvelopePrc9 | 116 | |
QPageSize::EnvelopePrc10 | 117 | |
QPageSize::EnvelopeYou4 | 118 | |
QPageSize::LastPageSize | EnvelopeYou4 | = EnvelopeYou4 |
Due to historic reasons QPageSize::Executive is not the same as the standard Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
The Postscript standard size QPageSize::Folio is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal if needed.
enum QPageSize::SizeMatchPolicy
| Constant | Value | Description |
|---|---|---|
QPageSize::FuzzyMatch | 0 | Match to a standard page size if within the margin of tolerance. |
QPageSize::FuzzyOrientationMatch | 1 | Match to a standard page size if within the margin of tolerance regardless of orientation. |
QPageSize::ExactMatch | 2 | Only match to a standard page size if the sizes match exactly. |
enum QPageSize::Unit
This enum type is used to specify the measurement unit for page sizes.
| Constant | Value | Description |
|---|---|---|
QPageSize::Millimeter | 0 | |
QPageSize::Point | 1 | 1/72th of an inch |
QPageSize::Inch | 2 | |
QPageSize::Pica | 3 | 1/72th of a foot, 1/6th of an inch, 12 Points |
QPageSize::Didot | 4 | 1/72th of a French inch, 0.375 mm |
QPageSize::Cicero | 5 | 1/6th of a French inch, 12 Didot, 4.5mm |