Jul-20-2017, 03:23 PM
I am trying to make my pdf appear as page 1 being the upper half of first page, and page 2 being the lower half of first page and so on.
Currently my code just moves page 2 onto page 1 completely overlaying what was on page 1 previously.
If anyone has any suggestions on how to achieve this I'd greatly appreciate it!
Currently my code just moves page 2 onto page 1 completely overlaying what was on page 1 previously.
If anyone has any suggestions on how to achieve this I'd greatly appreciate it!
from PyPDF2 import PdfFileReader, PdfFileWriter output = PdfFileWriter() file_name = '81plots.pdf' file1 = PdfFileReader(open(file_name, 'rb')) file2 = PdfFileReader(open(file_name, 'rb')) i = 0 for i in range(file1.getNumPages()-1): page = file1.getPage(i) page.mergePage(file2.getPage(i+1)) output.addPage(page) outfile = 'testfile.pdf' with open(outfile, 'wb') as file: output.write(file)