

The above command will only convert the pages 4 to 7 into images. pdftoppm -png -f 4 -l 7 test-document.pdf output-images The -f and -l stands for first and last respectively. If you want to convert only a specific range of pages in the document, use the -f and -l flags. If you do not specify a format, the tool generates the images with the PPM extension by default. Pdftoppm supports the following output formats: To convert the document into JPEG files: pdftoppm -jpeg test-document.pdf output-images To change the format of the output files, change the file extension in the command. For example, to use Question Mark ( ?) as the separator: pdftoppm -png -sep ? test-document.pdf output-images Change the Image Extension If you don't want it zero-padded, remove the leading zero.You can also change the character separator between the output name and the extension with the -sep flag. Obviously if you're dealing with more than a thousand entries, increase the number. The following will just stick a three-digit identifier ( 000, 001, 002, etc) on the end of the "myPDF": convert *.jpg myPDF%03d.pdf This doesn't recurse and you don't have to mess around cleaning up the filenames.Īnd I almost forgot, ImageMagick has a numerical output which might fit your use-case perfectly. This will also recurse into subdirectories unless you tell it (with -maxdepth 1 or other): find -name '*.jpg' -exec convert "" done It's excellent if you need to build in any sort of filtering (which you don't here) but it's still a favourite.

My first instinct for batch processing files is almost always find.
