Created
June 5, 2015 16:48
-
-
Save ericmjl/a0b5941b3cbf5aeb01da to your computer and use it in GitHub Desktop.
A Python script for stripping out metadata from a PDF file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from PyPDF2 import PdfFileReader, PdfFileMerger | |
files_dir = os.getcwd() | |
if 'stripped' not in os.listdir(files_dir): | |
os.mkdir('stripped') | |
for f in os.listdir(files_dir): | |
if f.split('.')[-1] == 'pdf': | |
merger = PdfFileMerger() | |
merger.append(PdfFileReader(f, 'rb')) | |
merger.write('stripped/{0}'.format(f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this isn't working anymore :(