How do I get the physical page dimensions?

Question:

How do I get the page dimensions in mm?

Answer:

PDF page coordinates (user space in the PDF standard) are by default (unless modified by the user unit scale) 1/72 inch. The code below will convert to metric.

double scale = page.GetUserUnitSize() / 72.0 * 25.4; // usually GetUserUnitSize is 1.0. PDF coordinates are in 1/72 of an inch. and 1 inch equals 25.4mm double mm_width = page.GetPageWidth() * scale; double mm_height = page.GetPageHeight() * scale;

1 Like