Print a bunch of files scaled to fit a page

Forgive my poor bash skills!

See script:

# print a PDF file resized to one page with pdfjam
for fn in "$@"
    echo "processing $fn"
    tmp1=$(mktemp /tmp/lpr-fit.XXXXXX.pdf)
    tmp2=$(mktemp /tmp/lpr-fit.XXXXXX.pdf)
    /usr/bin/pdfcrop --margins 50 $fn $tmp1
    /usr/bin/pdfjam --outfile $tmp2 --paper letter $tmp1
    lpr $tmp2
    rm -f $tmp1
    rm -f $tmp2

Resize page to fit paper

  pdfjam --outfile out.pdf --paper letter input.pdf

Add margins to pages

  pdfcrop --margins "100 100 100 100" input.pdf

(units are pt or 1/72 in)

Make thumbnail from first page

  convert -density 300 -resize %10 -background white \
  -alpha remove -bordercolor black -border 1 \
  ./ATL-COM-DAQ-2016-028.pdf[0] thumb.png

Apparently "[0]" selects the first page.

Last modified 13 months ago Last modified on Nov 14, 2019, 1:52:44 PM