📜  python split pdf pages - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:23.093000             🧑  作者: Mango

代码示例1
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)