Answers for "python program to separate pages in pdf"

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 "python program to separate pages in pdf"

Python Answers by Framework

Browse Popular Code Answers by Language