Saturday, March 5, 2016

Ghostscript JPG -> PDF

I'm not sure why I never posted this, but this is very useful when making documents from photos.

HOW TO CONVERT A JPG TO A PDF FILE:

gs \
 -sDEVICE=pdfwrite \
 -o outfile.pdf \
  /usr/local/share/ghostscript/8.71/lib/viewjpeg.ps \
 -c \(infile.jpg\) viewJPEG
Notice the \(...\) around the filename. They're important!

Also, the "/usr/local/share/ghostscript/8.71/lib/viewjpeg.ps" path varies, depending on the current installed version of ghostscript. Run the following to find your correct version:

find /usr/local/share/ghostscript -name viewjpeg.ps

Ref: http://stackoverflow.com/questions/4283245/using-ghostscript-to-convert-jpeg-to-pdf

No comments:

Post a Comment