Answers for "Split pdf based on content Python"

1

python split pdf pages

from PyPDF2 import PdfFileWriter, PdfFileReader

inputpdf = PdfFileReader(open("document.pdf", "rb"))

for i in range(inputpdf.numPages):
    output = PdfFileWriter()
    output.addPage(inputpdf.getPage(i))
    with open("document-page%s.pdf" % i, "wb") as outputStream:
        output.write(outputStream)
Posted by: Guest on January-27-2021

Code answers related to "Split pdf based on content Python"

Python Answers by Framework

Browse Popular Code Answers by Language