Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

How to calculate PDF page size in inches or centimeters

34 sec read

PDF page size is generally defined by the CropBox or MediaBox setting for each page. This is the number of pixels. This provides a set of 4 number (x,y,width,height) to define how big the page is. A common value is 0 0 595 842 for an A4 page.

However, most people are interested in actual units and that is what Adobe Reader or Acrobat displays. Here is the output from a file with CropBox[0 0 585 832] and MediaBox[0 0 585 832]

pdf page size (adobe)

So where does this number of centimeters come from?

Standard dpi is 72 dots per inch so we can convert the CropBox and MediaBox to inches by dividing these numbers by 72. This gives us 8.125 inches by 11.556 inches.

There are 2.54 centimeters in an inch so multiplying by this we get 20.635 cm by 29.35cm

So that is how Adobe creates the size from the raw PDF Crop or Media box sizes.

If you are interested in using JPedal to check PDF page size, there is a simple code example in this post.



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.