Skip to content

Instantly share code, notes, and snippets.

@Teqqles
Created January 19, 2017 12:14
Show Gist options
  • Save Teqqles/91a832e54a9925375547e7948acdadfa to your computer and use it in GitHub Desktop.
Save Teqqles/91a832e54a9925375547e7948acdadfa to your computer and use it in GitHub Desktop.
Remove those pesky cover sheets from a PDF résumé
from PyPDF2 import PdfFileWriter, PdfFileReader
import sys
pages_to_remove = [0]
if len(sys.argv) < 3:
raise ValueError("A source and destination file need to be supplied")
infile_name = sys.argv[1]
outfile_name = sys.argv[2]
infile = PdfFileReader(infile_name)
output = PdfFileWriter()
for i in range(infile.getNumPages()):
page_data = infile.getPage(i)
if i not in pages_to_remove:
output.addPage(page_data)
with open(outfile_name, 'wb') as f:
output.write(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment