Paper Dimensions for Creating PDFs

October 17, 2019 ยท 4 minute read

I am working on a project where I have to generate PDFs that are ready to print. And given that the sizes differ depending on whether you live in or outside North/Central America, I thought it would be a good idea to just list how one would calculate measurements to pixels and dots per inch (DPI).

US Letter Dimensions

The dimensions of US Letter paper are different to A4 paper. The US, Canada (and parts of Mexico) are the only countries in the world that don’t use the IS0 216 standard for paper sizes.

The standards for US Letter paper is defined by the American National Standards Institute (ANSI) and the dimensions of A4 follow the International Organization for Standardization (ISO) 216 standard. I didn’t know this, but that now added an additional layer of complexity.

The width and height of US Letter paper are, as follows:

  • In millimeters: 215.9mm x 279.4mm
  • In centimeters: 21.59cm x 27.94cm
  • In inches: 8.5in x 11in

US Letter Dimensions In Pixels

If you’re creating a Photoshop image file or just a plain PDF, the pixel dimensions will vary based upon the dots per inch (DPI). 72 DPI is standard for the web, but 300 DPI is standard for printing images.

  • US Letter at 72dpi: 612 pixels x 792 pixels
  • US Letter at 300dpi: 2550 pixels x 3300 pixels

A4 Paper Dimensions

The A4 paper size is commonly used for printing documents such as letters, magazines, forms and posters.

The dimensions of A4 paper are as follows:

  • In millimeters: 210mm x 297mm
  • In centimeters: 21cm x 29.7cm
  • In inches: 8.27in x 11.69in

A4 Paper Dimensions In Pixels

Note that if you’re creating a Photoshop image or PDF file, the pixel dimensions will vary based upon the dots per inch (DPI) of the image.

  • A4 at 72dpi: 595 pixels x 842 pixels
  • A4 at 300dpi: 2480 pixels x 3508 pixels
  • A4 at 600dpi: 4960 pixels x 7016 pixels

Other paper sizes

I also learned that the A series system of paper was first adopted in Germany in 1922. The sizes were calculated in such a way that each size is made by dividing the size immediately above into two equal parts. The sizes are all the same geometrically as they are made using the same diagonal. The basic size A0 is one square meter in area. Other Paper Sizes

How do I apply all of this knowledge to my project?

I first have to create a couple of properties that will hold the height and width of the paper type I plan to use as a CGFloat. These properties will use the pixel values for the paper size I need to generate my PDFs.

let A4PageWidth: CGFloat = 595.0
let A4PageHeight: CGFloat = 842.0
let USLetterWidth: CGFloat = 612.0
let USLetterHeight: CGFloat = 792.0

Then I will use these values to define the page’s frame in a class that uses the UIPrintPageRenderer library:

//specify frame of the A4 page
let pageFrame = CGRect(x: 0.0, y: 0.0, width: A4PageWidth, height: A4PageHeight)

//specify frame of the US Letter page
let pageFrame = CGRect(x: 0.0, y: 0.0, width: USLetterWidth, height: USLetterHeight)

Then set the printableRect value, which defines the size of the paper used for printing:

 self.setValue(NSValue(cgRect: pageFrame), forKey: "printableRect")

All the code using the A4 paper setup (if you need the US Letter, just swap out the properties):

 override init()
        //specify frame of the A4 page
        let pageFrame = CGRect(x: 0.0, y: 0.0, width: A4PageWidth, height: A4PageHeight)
        //set the page frame
        self.setValue(NSValue(cgRect: pageFrame), forKey: "paperRect")
        //set the printableRect
        self.setValue(NSValue(cgRect: pageFrame), forKey: "printableRect")
        // Custom header and footer heights
        self.headerHeight = 50.0
        self.footerHeight = 50.0

I don’t recommend clicking on the reference link - has a bunch of ads and trackers, but if you must, here’s where I got the paper sizing informations: Reference

Subscribe to my email list for a monthly newsletter and special updates!