LLION/ PDF, print & document engineering

PDF units: points and user space

LLION Editorial · Updated

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 /UserUnit when 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.

An A4 page in user space: origin at the lower-left corner, x axis to the right, y axis upward, MediaBox from (0, 0) to (595.28, 841.89), and a text position at (72, 770) near the top-left (0, 0) (595.28, 841.89) x y 72 770 Td 1 inch from the left,1 inch below the top MediaBox[0 0 595.28 841.89] A4 in points:210 mm = 595.28 pt297 mm = 841.89 pt
Coordinates grow up and to the right. The text position (72, 770) on an A4 page is one inch in from the left edge and 71.89 pt below the top edge.

Three details follow from the definition:

  • Coordinates are real numbers. Nothing snaps to a grid; 100.5 200.25 is as valid as 100 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.

Portrait dimensions. Swap width and height for landscape.
SizeDefined asWidth (pt)Height (pt)Rounded (pt)
A0841 × 1189 mm2383.9373370.3942383.94 × 3370.39
A1594 × 841 mm1683.7802383.9371683.78 × 2383.94
A2420 × 594 mm1190.5511683.7801190.55 × 1683.78
A3297 × 420 mm841.8901190.551841.89 × 1190.55
A4210 × 297 mm595.276841.890595.28 × 841.89
A5148 × 210 mm419.528595.276419.53 × 595.28
A6105 × 148 mm297.638419.528297.64 × 419.53
B4250 × 353 mm708.6611000.630708.66 × 1000.63
B5176 × 250 mm498.898708.661498.90 × 708.66
US Letter8.5 × 11 in612792612 × 792
US Legal8.5 × 14 in6121008612 × 1008
Tabloid11 × 17 in7921224792 × 1224
Executive7.25 × 10.5 in522756522 × 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.

Pixels per unit at common resolutions. Multiply a dimension in points or millimetres by the factor for your resolution.
Resolution1 pt =1 mm =1 in =A4 pageLetter page
72 DPI1 px2.8346 px72 px595 × 842 px612 × 792 px
96 DPI (CSS)1.3333 px3.7795 px96 px794 × 1123 px816 × 1056 px
150 DPI2.0833 px5.9055 px150 px1240 × 1754 px1275 × 1650 px
300 DPI4.1667 px11.8110 px300 px2480 × 3508 px2550 × 3300 px
600 DPI8.3333 px23.6220 px600 px4960 × 7016 px5100 × 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.A4 is [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.units providing inch, cm and mm as multipliers (mm = 72 / 25.4), and reportlab.lib.pagesizes providing A4, letter and friends in points.
  • iText and PDFBox (Java), PDFsharp (C#): points, with helper classes for named sizes; PDFsharp's XUnit converts 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