on-internet
← Community

Resize pdf pages in Python

Stack Overflow ·

I am using python to crop pdf pages. Everything works fine, but how do I change the page size(width)? This is my crop code: input = PdfFileReader(file('my.pdf', 'rb')) p = input.getPage(1) (w, h) = p.mediaBox.upperRight p.mediaBox.upperRight = (w/4, h) output.addPage(p) When I crop pages, I need to resize them as well, how can I do this?

Comments

Sign in or sign up to comment and upvote.

No comments yet.