-1

I need to split a roughly 380 page pdf file into sets of 10 pages using python. My initial thoughts are to use PyPDF2 but I have no experience with it. I do need a mechanism to ensure the final PDF is saved despite it being under 10 pages. (eg. 383 page pdf should save as 38 10-page PDF and a 3 page pdf).

Sam Oberly
  • 13
  • 2

1 Answers1

-1

Use pyPDF2 to read the PDF file. Use PdfFileReader.getNumPages() to get the page count. Split the pages into groups of ten, adding each to a PdfFileWriter instance. Repeat for any leftover pages.

The basic_features.py sample code in the pyPDF2 repo makes this pretty clear.

Kevin
  • 398
  • 2
  • 7