Replies: 1 comment 2 replies
-
Before digging deeper here or doing a more extensive analysis, to answer the easy part:
The crop box is the region to display or print (see section 14.11.2.1 of the PDF 2.0 specification). As all corresponding page boxes, it can basically be whatever rectangle you want it to be. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For a pdf file, I'm trying to duplicate the first page, rotate it by 180º and merge it with the first page such that they appear below each other. I've come up with the following solution.
I tried it on the following three files:
01.pdf
;Unfortunately, the script only seems to work for
01.pdf
. In02.pdf
, it seems to translate the rotated page down by the old mediabox height. In03.pdf
, the file size is doubled, but nothing appears to happen visibly.Digging around, I found this answer to a discussion thread on rotating pages: #903 (comment)
In the code example, Martin asserts that the x1 and y1 coordinates of the page's cropbox start at 0. I suppose that in my code, I'd have to check the following before inserting the translated page.
This assertion fails in
02.pdf
and03.pdf
. I assume this is also the reason, whymerger.pages[0].mediabox.height
does not, in fact, correspond to thety
coordinate where I want to stitch the page to.I've tried juggling around with variables and expressions to come up with the correct translation value, but to no avail. Does anyone know how to fix this? Also, what causes the cropbox of a page not to start at 0, 0?
Beta Was this translation helpful? Give feedback.
All reactions