Created
October 20, 2017 17:09
-
-
Save hepplerj/671da18b01f88d25c3260f465429ce75 to your computer and use it in GitHub Desktop.
Batch compress PDFs for Omeka
This file contains hidden or 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
# This requires the use of GhostScript | |
# On macOS, the easiest way to get started is install with Homebrew | |
# brew install ghostscript | |
# | |
# This file should live in the directory that contains the PDFs. From | |
# the command line, just running `bash batch.sh` will compress the PDFs | |
# and fix any issues that might be present with JPEG2000 images. The | |
# compression process should preserve the OCR and will likely reduce the | |
# size of the PDF as well. | |
# | |
# Flattened files will be appended with `.flatened.pdf` and will not overwrite | |
# the original PDFs. | |
for files in *.pdf | |
do | |
gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite -sOutputFile=$files.flattened.pdf $files | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment