I had scanned a bunch of images and needed to bundle them all up into PDF. It took about 20 minutes to figure out, which is way too long, so here’s the steps so I can remind myself in the future:
- scanimage –batch=”%d.tiff” –format=tiff –resolution 300 –bgcolor white –mode=Lineart
- ls -tr1 | xargs -Ixxx lp -d PDF -o fitplot -o page-top=0 -o page-bottom=0 -o page-left=0 -o page-right=0 “xxx”
- gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=finished.pdf `ls -tr1` OR pdftk `ls -tr1` cat output finished.pdf
- pdftk finished.pdf output enc.pdf user_pw <pass> allow CopyContents printing
Notes:
- gs may be able to do step 2, but if it can’t you’ll need to install “cups-pdf” and restart cups.
- gs may also be able to do 1-3 in 1 step.
- Similarly, pdftk might be able to do most of this in 1 step, too. It just didn’t occur to me until after I used it for the encryption.