Created
May 15, 2017 06:58
-
-
Save baisong/41c82374a3b36c17b55d37fc1f5b40c7 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
############################# | |
# | |
# Usage: | |
# ./mergepdf Example | |
# >> Example.pdf | |
# | |
# Run inside a directory with PDFs named like page1.pdf page2.pdf... | |
# | |
############################# | |
FILENAME=$1 | |
echo "Creating $(echo $FILENAME)_raw.pdf..."; | |
pdftk *.pdf output `(echo $FILENAME)`_raw.pdf | |
echo "Reducing filesize..." | |
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r300 -sOutputFile=`(echo $FILENAME)`.pdf `(echo $FILENAME)`_raw.pdf | |
echo "Done!" | |
echo " " | |
echo $(pwd)/$(echo $FILENAME).pdf | |
echo " " | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment