Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python Scripts Collections
#! /usr/bin/python
# reference:
import glob
from PyPDF2 import PdfFileWriter, PdfFileReader
for fname in glob.glob('./*.pdf'):
infile = PdfFileReader(fname, 'rb')
output = PdfFileWriter()
print("file name:", fname, "with pages: ", infile.getNumPages())
# getNumPages() starts with 0
for i in range(1, infile.getNumPages()):
p = infile.getPage(i)
with open(fname, 'wb') as f:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.