from pyPdf import PdfFileWriter PdfFileReader output PdfFileWriter inp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from pyPdf import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
input = PdfFileReader(open("input.pdf", 'rb'))
for x in xrange(input.numPages):
page = input.getPage(x)
box = page.mediaBox
box.upperLeft = (box.getUpperLeft_x() / 1.1, box.getUpperLeft_y() / 1.1)
box.lowerLeft = (box.getLowerLeft_x() + 50, box.getLowerLeft_y() + 50)
output.addPage(page)
output.write(open("output.pdf", "wb"))