35 Votes

PDF: MediaBox Size for A4 Format Page

Question by Guest | Last update on 2020-11-13 | Created on 2014-03-20

Currently, I am trying to create a PDF document manually. By default, the MediaBox in a Page-Object (visible page size) is defined as "/MediaBox [0 0 612 792]". Apparently, this is the format "Letter".

However, I would like to create a page in the A4 format (DIN A4, ISO-Norm 216). Which values should I use instead of 612 and 792 for my MediaBox?

ReplyPositiveNegative
3Best Answer3 Votes

The values exact to the fourth decimal place would be 595.2756 and 841.8898 for a page in A4 portrait orientation, so:

/MediaBox [0 0 595.2756 841.8898]

However, most programs (as for example also the PDF export from OpenOffice) are using rounded values instead. Without the decimal places, it is:

/MediaBox [0 0 595 842]

The data has to be stated in the unit point. One point is defined as 1/72 of an inch (2,54 cm).

The A4 format has width of 21 cm (8.2677 inch) and a height of 29.7 cm (11.6929 inch). Thus, the width in point is 8.2677*72 = 595.2756 and the height in point is 11.6929*72 = 841.8898.
2014-03-21 at 19:39

ReplyPositive Negative
Reply

Related Topics

PHP: File Download Script

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.