PDF units: points and user space
- 1 point (pt)
- 1/72 inch exactly = 0.352778 mm = 1.333333 CSS pixels
- 1 inch
- 72 pt = 25.4 mm = 96 CSS px
- 1 millimetre
- 2.834646 pt = 3.779528 CSS px
- 1 CSS pixel
- 0.75 pt = 1/96 inch = 0.264583 mm
- Default user space unit
- 1/72 inch (ISO 32000-1 §8.3.2.3); scaled by
/UserUnitwhen present - Origin
- lower-left corner by convention, x to the right, y upwards
Everything positioned in a PDF, from page boxes to the text operators in a content stream, is expressed in these units. Pixels do not exist in the format: an image has a pixel grid, but it is placed on the page by a transformation into points, and the viewer decides how many device pixels a point gets.
User space#
ISO 32000-1 defines a device-independent coordinate system for each page called user space. Its unit, in default user space, is 1/72 inch. The x axis runs to the right and the y axis runs up, "as in standard mathematical practice", which is the opposite of screen graphics and the reason a line of text at the top of an A4 page sits at y ≈ 770, not y ≈ 70.
Three details follow from the definition:
- Coordinates are real numbers. Nothing snaps to a grid;
100.5 200.25is as valid as100 200. Precision is a matter of how many decimals the writer emits. - Rectangles are four numbers,
[llx lly urx ury]: the lower-left and upper-right corners.[0 0 612 792]is US Letter with the origin at the corner;[20 20 632 812]is the same size offset by 20 pt. Page boxes, annotation rectangles and form field positions all use this form, and the page-boxes page covers what happens when they differ. - The origin is not required to be at the corner. The specification notes that PostScript's lower-left convention is common but not mandatory in PDF; the visible area is whatever the CropBox says. In practice almost every file uses
[0 0 w h].
Drawing is done through the current transformation matrix. The cm operator multiplies a matrix into the CTM, so 0.5 0 0 0.5 0 0 cm halves everything that follows and 1 0 0 1 72 72 cm moves the origin an inch in from the corner. A page with /Rotate 90 is still laid out in the same user space; the rotation is applied at display time. The operators themselves are introduced on the objects and syntax page.
UserUnit#
Since PDF 1.6 a page dictionary may carry /UserUnit, a positive number giving the size of a user space unit in multiples of 1/72 inch (ISO 32000-1, Table 30). The default is 1.0. Its purpose is large formats: Acrobat limits a page to 14,400 by 14,400 units, which is 200 inches (Adobe PDF Reference, Appendix C), so a 40-metre engineering drawing sets /UserUnit 10 and works in units of ten points at ten times the scale. Few generators write it and some viewers ignore it, so a page that depends on it should say so. When you read a page size from a file, multiply by UserUnit if it is present or the number will be ten or a hundred times too small.
Page sizes in points#
Values are exact in the unit each standard defines (millimetres for ISO 216, inches for North American sizes) and converted at 72 pt per inch. The two-decimal column is what most libraries and viewers report.
| Size | Defined as | Width (pt) | Height (pt) | Rounded (pt) |
|---|---|---|---|---|
| A0 | 841 × 1189 mm | 2383.937 | 3370.394 | 2383.94 × 3370.39 |
| A1 | 594 × 841 mm | 1683.780 | 2383.937 | 1683.78 × 2383.94 |
| A2 | 420 × 594 mm | 1190.551 | 1683.780 | 1190.55 × 1683.78 |
| A3 | 297 × 420 mm | 841.890 | 1190.551 | 841.89 × 1190.55 |
| A4 | 210 × 297 mm | 595.276 | 841.890 | 595.28 × 841.89 |
| A5 | 148 × 210 mm | 419.528 | 595.276 | 419.53 × 595.28 |
| A6 | 105 × 148 mm | 297.638 | 419.528 | 297.64 × 419.53 |
| B4 | 250 × 353 mm | 708.661 | 1000.630 | 708.66 × 1000.63 |
| B5 | 176 × 250 mm | 498.898 | 708.661 | 498.90 × 708.66 |
| US Letter | 8.5 × 11 in | 612 | 792 | 612 × 792 |
| US Legal | 8.5 × 14 in | 612 | 1008 | 612 × 1008 |
| Tabloid | 11 × 17 in | 792 | 1224 | 792 × 1224 |
| Executive | 7.25 × 10.5 in | 522 | 756 | 522 × 756 |
A4 is the size that causes trouble: 595 × 842 (integers), 595.28 × 841.89 (two decimals) and 595.276 × 841.89 (ReportLab's A4 constant, computed from 210 mm) are all in circulation and all mean A4. Tools that compare page sizes should allow a tolerance of a point or so, as the PDF inspector does when it names a page size. The full list of sizes in every unit is on the paper sizes page.
Converting to pixels#
A point maps to a number of pixels only once a resolution is chosen. On screen, CSS fixes 96 px per inch, so 1 pt is 1.3333 px and a 612 pt page is 816 px wide at 100% zoom. For raster output, choose the DPI and multiply.
| Resolution | 1 pt = | 1 mm = | 1 in = | A4 page | Letter page |
|---|---|---|---|---|---|
| 72 DPI | 1 px | 2.8346 px | 72 px | 595 × 842 px | 612 × 792 px |
| 96 DPI (CSS) | 1.3333 px | 3.7795 px | 96 px | 794 × 1123 px | 816 × 1056 px |
| 150 DPI | 2.0833 px | 5.9055 px | 150 px | 1240 × 1754 px | 1275 × 1650 px |
| 300 DPI | 4.1667 px | 11.8110 px | 300 px | 2480 × 3508 px | 2550 × 3300 px |
| 600 DPI | 8.3333 px | 23.6220 px | 600 px | 4960 × 7016 px | 5100 × 6600 px |
The 72 DPI row is why "points equal pixels" is a common belief: on the original Macintosh screen and in many image editors' defaults, they did. CSS chose 96 because that was the Windows convention, which is why a 12 pt font is 16 px in a browser and why Chromium's PDF output maps 96 CSS px to 72 pt, so a 794 px wide HTML page prints as an A4 width. The unit converter does these conversions at any resolution.
Which point#
The PDF point, the PostScript point and the DTP point are the same thing: 1/72 inch exactly, adopted by PostScript in 1984, by Apple for the Macintosh, and by CSS in 1996. The specification itself is careful to say that the default user space unit is only "approximately the same as a point" because the printing industry never had one definition. The traditional American printer's point is 0.013837 in, or 1/72.27 in, which is also TeX's pt; TeX calls the 1/72 in unit bp, the big point. The Didot point used in continental Europe is 0.3760 mm. None of these appear in PDF files; if a layout program reports sizes in Didot or TeX points, convert before writing coordinates.
How libraries expose units#
- pdf-lib (JavaScript): everything in points.
page.getSize()returns{ width, height }in points;PageSizes.A4is[595.28, 841.89]. - PDFKit (Node.js): points.
size: [width, height]is documented as "PDF points (72 per inch)"; named sizes such as'A4'and'LETTER'are built in. The default page is Letter. - ReportLab (Python): points, with
reportlab.lib.unitsprovidinginch,cmandmmas multipliers (mm = 72 / 25.4), andreportlab.lib.pagesizesprovidingA4,letterand friends in points. - iText and PDFBox (Java), PDFsharp (C#): points, with helper classes for named sizes; PDFsharp's
XUnitconverts between point, inch, millimetre and presentation units. - Chromium, WeasyPrint and other HTML renderers: you write CSS in any absolute unit and the engine converts at the CSS ratios, 96 px per inch, into points in the PDF.
- Viewers: the zoom percentage is relative to the viewer's own assumption about screen density, usually 96 DPI on Windows and 72 or 110 on macOS applications, which is why "100%" is not the same physical size everywhere.
Sources
- ISO 32000-1:2008, §8.3.2.3 User space, §8.3.3 Common transformations, Table 30 (UserUnit) free copy distributed by Adobe
- Adobe, PDF Reference sixth edition (PDF 1.7), Appendix C implementation limits (page size 3 to 14,400 units)
- W3C, CSS Values and Units Module Level 4, §6.2 Absolute lengths
- Wikipedia, "Point (typography)" (DTP point, printer's point, Didot point, TeX units)
- PDFKit documentation, page sizes in points
- ReportLab user guide, reportlab.lib.units
- pdf-lib API, PDFDocument and PDFPage