Skip to content
Discussion options

You must be logged in to vote

Aha! Thanks, that is much clearer now! So we have the following rectangles:

  1. Current page size cur_rect = fitz.Rect(0, 0, 360, 576)
  2. New page size new_rect = fitz.Rect(0, 0, 369, 594)
  3. Target rect on even (left) pages evn_rect = fitz.Rect(9, 9, 369, 585)
  4. Target rect on odd (right) pages 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 either evn_rect or odd_rect within it, depending on the page number.
When done save and close the…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@JorjMcKie
Comment options

Answer selected by byteinsight
@byteinsight
Comment options

@JorjMcKie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2837 on November 22, 2023 19:39.