what is the width of a A4 page in pyhanko box? #109
-
As per my experiments:
Question is what is the top of the page value at? and the horizontal width of it? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
As usual, the answer is "it depends" ;). PyHanko writes those values to the PDF as-is. Typically that means that you're working in default user space units. Theoretically those are viewer-dependent, but by convention those are in points, so 1 unit = 1/72th of an inch. Again assuming no funny business with transformed coordinates, the origin PyHanko doesn't care about page sizes at all, FWIW. It'll happily draw stuff out of bounds without complaining. Page size is defined by the page's MediaBox (or CropBox) entry, but pyHanko doesn't process these values. |
Beta Was this translation helpful? Give feedback.
-
I had the same question. Maybe it helps users when this scaling factor between mm and points is clearly mentioned in the documentation and examples. |
Beta Was this translation helpful? Give feedback.
-
The coordinates are Cartesian, starting from bottom left and work at 72 DPI in most PDF docs. That makes the bottom-left corner of any sheet x = 0, y = 0 and the top-right corner of an A4 sheet about x = 595, y= 841 if your PDF uses 72 DPI. |
Beta Was this translation helpful? Give feedback.
As usual, the answer is "it depends" ;). PyHanko writes those values to the PDF as-is. Typically that means that you're working in default user space units. Theoretically those are viewer-dependent, but by convention those are in points, so 1 unit = 1/72th of an inch. Again assuming no funny business with transformed coordinates, the origin
(0,0)
is at the bottom left (i.e. PDF uses the Cartesian convention).PyHanko doesn't care about page sizes at all, FWIW. It'll happily draw stuff out of bounds without complaining. Page size is defined by the page's MediaBox (or CropBox) entry, but pyHanko doesn't process these values.