Generating PDFs of images with linux

Last week i get an interessting task. How to convert scanned documents from eg. jpeg or png to pdf? With Linux this should easily be possible, i thought. So, i started googleing arround and found two very usefull tools. ImageMagick and pdftk.
I had a couple of pngs where some of them were continuous pages of one scanned document. In the first step i tried to convert all files to pdfs and then i wanted to join the pdfs to one single document.
For the first step i used convert from the ImageMagick-Toolkit. I wrote a small shellscript that does the whole work for me 😉

for i in $(ls -1); do convert $i $i.pdf; done;

This does all the conversions for me and i got a lots of pdf-files in the directory.
The next step was the compounding of the files. My researches brought up the pdftk. A tool, which fits my whole needs and is simple to use. All i had to do was

pdftk file1.pdf file2.pdf file3.pdf cat output out.pdf

then i got my designated pdf-file in out.pdf .

I love my linux-system 😀