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