11/13/2019

PDF split page and save each page to pdf, python

#pip3 install PyMuPDF
import fitz
doc = fitz.open('./test2.pdf'

#page_number = doc.pageCount
#print(page_number)

#split pages
for i, page in enumerate(doc.pages()):
    print(i)
    doc2 = fitz.open()               
    doc2.insertPDF(doc, to_page = i) 
    doc2.save("{}.pdf".format(i))

No comments:

Post a Comment