Recently I’ve bought a new laser printer from HP and I started to use XSane for scanning – unfortunately the program produces .pnm file for every scanned page and even though these are quite big and pretty much useless for attaching to emails and so. I’ve come up with following solution which works for me:
You will need ImageMagick and GhostScript (but very probable you have them both already installed) – if not:
sudo apt-get install imagemagick sudo apt-get install imagemagick
And then you can run two following commands to get nice and lightweight single PDF file generated from your .PNM files:
convert out-000* concatenated.pdf gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf concatenated.pdf
I’m just wondering if anyone has some better or simpler way how to deal with these .pnm files and would like to share it in the comments?