command line multiple pnm conversion to single pdf file

Problem

You have multiple scanned images as pnm files, and you would like to convert them to a single pdf file.

 

Solution

If you have imagemagick installed you should be able to use the convert as follows to combine the images to one pdf file:

convert image1.pnm image2.pnm image3.pnm output.pdf