• Joining multiple JPEGs into a multipage PDF

    Sat, 10 Aug 2013 13:18:46 +0200Posted by Andre Landwehr

    [Tips & Tricks]

    If you ever wondered how to convert multiple JPEG files (e.g. some scanned in pages) into one big PDF file, and not all of these have the same resolution, you might have had a hard time figuring out how to do this with free software under Linux. Here is the solution:
    First, convert each invidual JPEG into a PDF:
    for I in *.jpg; do BASE=`echo $I | sed -e 's/.jpg//'`; convert "$BASE.jpg" "$BASE.pdf" ; done
    Then, join all the PDFs together into one big document:
    pdftk first.pdf second.pdf third.pdf fourth.pdf cat output combined.pdf
    Using this combination of tools gave the best results for me, far superior to any in-between conversion to postscript or importing everything into The Gimp first and saving as PDF from there.h