python split pdf pages

Solutions on MaxInterview for python split pdf pages by the best coders in the world

showing results for - "python split pdf pages"
David
01 Jun 2018
1from PyPDF2 import PdfFileWriter, PdfFileReader
2
3inputpdf = PdfFileReader(open("document.pdf", "rb"))
4
5for i in range(inputpdf.numPages):
6    output = PdfFileWriter()
7    output.addPage(inputpdf.getPage(i))
8    with open("document-page%s.pdf" % i, "wb") as outputStream:
9        output.write(outputStream)
10