Skip to content
Discussion options

You must be logged in to vote

Ok, good! Alright then.
I am calling the scale factor scale. After the following code snippet, pages are resized, have rotation 0 and CropBox = MediaBox.

src = fitz.open("input.pdf")
doc = fitz.open()
for srcpage in src:
    srect = srcpage.rect
    w, h = srect.width, srect.height
    w *= scale
    h *= scale
    rot = srcpage.rotation
    srcpage.set_rotation(0)
    page = doc.new_page(width=w, height=h)
    page.show_pdf_page(page.rect, src, srcpage.number, rotate=-rot)
doc.ez_save("output.pdf")

Replies: 8 comments 24 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@JorjMcKie
Comment options

@JorjMcKie
Comment options

Comment options

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

@pachhaipurna
Comment options

@pachhaipurna
Comment options

Comment options

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

@pachhaipurna
Comment options

@pachhaipurna
Comment options

@JorjMcKie
Comment options

Answer selected by pachhaipurna
@pachhaipurna
Comment options

@JorjMcKie
Comment options

Comment options

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

Comment options

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

@pachhaipurna
Comment options

@pachhaipurna
Comment options

@JorjMcKie
Comment options

@JorjMcKie
Comment options

Comment options

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

@JorjMcKie
Comment options

@pachhaipurna
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants