Apr 032013
 

Scanning paper documents is such a tedious task that I tend to lose concentration when doing it. And as a result I recently ended up with two PDF documents needing post-processing. In the worst case, the PDF consisted of three pages – one in the correct orientation, and two rotated 180°!

As usual, there’s a Unix command to help out with that – pdftk. Specifically :-

pdftk \
  input-file.pdf \
  cat 1 2-endS \
  output out.pdf

The interesting operation is contained within the cat 1 2-endS which translates as copy the input page 1 to the output unaltered, and copy the remaining pages rotated 180° (or “S”) to the output. This is of course only the tiniest fraction of what this tool can do.