Ghostscript: How to Convert JPEG to PDF
By Jonah Quant
Ghostscript is a software suite containing utilities to convert and manipulate graphical documents in Adobe's PostScript and Portable Document Format (PDF) formats. Ghostscript can generate files in many standard image formats from a PostScript or PDF document, or vice versa. In particular, you can use "gs" (the main utility included in the Ghostscript suite) to convert an image file in JPEG format to PDF.
Click "Start," then type "cmd" into the search box and press "Enter." A Command window will open.
Type the following commands into the Command window:
dir /s viewjpeg.ps
Press "Enter" at the end of each line. The output of the "dir" command will include the full path to the built-in "viewjpeg.ps" file. That file is always present in all installations of Ghostscript, but its location varies depending on the release of Ghostscript and on other configuration parameters. Make a note of that full path.
Type the following command into the Command window to have "gs" perform the format conversion:
gs -sDEVICE=pdfwrite -o myFile.pdf "C:\Programs\Ghostscript\lib\viewjpeg.ps" -c myFile.jpg viewJPEG
Replace "C:\Programs\Ghostscript\lib\viewjpeg.ps" with the full path obtained in Step 2. Replace "myFile.jpg" with the file name of the JPEG file you need to convert. Press "Enter." After "gs" finishes executing, the PDF equivalent of your JPEG file will be stored in file "myFile.pdf".
Jonah Quant has been writing about computer science since 1990. He has contributed to international conferences and journals such as those of the Institute of Electrical and Electronics Engineers and the Association for Computing Machinery. Quant has a Ph.D. in computer science from the University of California.