CONVERT IMAGE FILES INTO A SINGLE PDF FILE

Use convert (an utility that is part of the ImageMagick package) to convert a bunch of images into a single pdf file:

convert *png output.pdf

NOTE:

If you receive an ‘Out of memory’ message when running the above command, do the following:

1. set the TMPDIR variable to a directory with enough space:

export TMPDIR=/var/tmp

2. run ‘convert’ with the ‘cache’ option:

convert -cache 500 *png output.pdf (assigns 500 Mb to the pixel cache) 

MERGE SEVERAL PDF FILES INTO A SINGLE FILE

Use the Ghoscript ‘gs’ command:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf 001.pdf 002.pdf 003.pdf