Skip to content
Discussion options

You must be logged in to vote

Here is the script that does work for both those files.
Explanation:
The "rotate" argument in show_pdf_page can only work in a foreseeable way, if the source page is not rotated. If it is rotated, use my code snippet from a previous post.

import fitz

doc1 = fitz.open("syousa2.pdf")
doc2 = fitz.open("syousa_2up.pdf")

newpdf = fitz.open()
w, h = fitz.paper_size("a3-l")

# left and right A4 rectangles:
rl = fitz.paper_rect("a4")
rr = rl + (rl.width, 0, rl.width, 0)

for page in doc1:  # loop through source pages
    if not page.number % 2:  # on even pages create the output A3 page
        rect = rl
        newpage = newpdf.new_page(width=w, height=h)
    else:
        rect = rr

    if page.

Replies: 8 comments 4 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
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shin1007
Comment options

Comment options

You must be logged in to vote
1 reply
@shin1007
Comment options

Comment options

You must be logged in to vote
1 reply
@shin1007
Comment options

Comment options

You must be logged in to vote
1 reply
@shin1007
Comment options

Answer selected by shin1007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants
Converted from issue

This discussion was converted from issue #1377 on November 08, 2021 09:05.