Created
July 30, 2015 16:32
-
-
Save flobeck/d6d36abb6859c7221f9c to your computer and use it in GitHub Desktop.
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
# cropping multiple .pdfs with pdfcrop | |
# place this script in the directory with the pdfs you want to crop | |
# usage: python pdfcrop.py <left> <top> <right> <bottom> | |
import sys, os, subprocess | |
pdfcrop = 'pdfcrop --margin \'-%s -%s -%s -%s\' %s %s' | |
pdfs = [f for f in os.listdir('.') if f.endswith('.pdf')] | |
for pdf in pdfs: | |
cmd = pdfcrop % (sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], pdf, 'cropped'+pdf) | |
subprocess.call(cmd, shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment