Created
April 24, 2014 03:02
-
-
Save vphill/11240008 to your computer and use it in GitHub Desktop.
Bash script used to created pdf files for the Texas State Documents Scanning process
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
for i in * | |
do | |
echo "creating pdfs" | |
find "$i" -maxdepth 1 -name "*.jpg" | xargs -i -n 1 -P 6 convert -density 200x200 -compress jpeg -quality 80 "{}" "{}".pdf | |
echo "compressing pdfs" | |
find "$i" -maxdepth 1 -name "*.jpg.pdf" | xargs -i -n 1 -P 5 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile={}_out.pdf {} | |
cd "$i" | |
echo "concatinating pdfs" | |
pdftk *_out.pdf cat output temp.pdf | |
echo "linerizing pdf" | |
qpdf --linearize temp.pdf $i.pdf | |
rm *.jpg.pdf | |
rm *_out.pdf | |
rm temp.pdf | |
mkdir 01_jpg | |
mv *.jpg 01_jpg | |
mkdir 02_pdf | |
mv "$i".pdf 02_pdf | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment