Add Offset Bleed Margins to existing PDF #2838
-
Hi, I have some pdfs that I need to add bleed margins to. I have seen this previous question which has got me some way towards a solution but not quite all the way there. I need to add a variable called bleed_margin_pixels to the top, bottom and outer edge. At the moment I have
But its the two lines:
where I'm kinda guessing and not sure its yet right. I don't want the original content to be resized. It should stay the same size. Thanks for your help. :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
This is no issue, but a Discussions item. Transferring ... |
Beta Was this translation helpful? Give feedback.
-
Several comments:
|
Beta Was this translation helpful? Give feedback.
-
Hi Jorj, Thank you for your response and moving my question into the correct area. I really appreciate your time. For clairfication, I don't need to reduce the visible part of the page but add 'whitespace' around it. Although I appreciate this might be what you are describing from a different direction! I've attached an image to show what I'd like to achieve.
The green box some what complicates this as its artwork I'm positioning as shown. At the moment I'm able to add the green artwork to the PDF but on the original blue dimensions. Trimming this once printed offsets the blue content hence the requirement for the red bleed area. Hope this makes sense. Thanks again for your time. |
Beta Was this translation helpful? Give feedback.
Aha! Thanks, that is much clearer now! So we have the following rectangles:
cur_rect = fitz.Rect(0, 0, 360, 576)
new_rect = fitz.Rect(0, 0, 369, 594)
evn_rect = fitz.Rect(9, 9, 369, 585)
odd_rect = fitz.Rect(0, 9, 360, 585)
I hope I didn't make stupid errors. Rectangles 3 and 4 correspond the blue rectangles in your nice drawings.
So your script would open a new PDF and read the old, current PDF page by page, make a new page on the new PDF with size
new_rect
and position the current old page on eitherevn_rect
orodd_rect
within it, depending on the page number.When done save and close the…