Wednesday, March 27, 2013

Working with GhostScript : Convert PDF to images using ghostscript

Ghostscript is an interpreter for PostScript™ and (PDF) files, lets see how we can use it convert PDF to images.

-Install Ghostscript (I am using ubunutu, so I can perform)
sudo apt-get install ghostscript

- run these script via console to make images from pdf

gs -dUseCropBox -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dAdjustWidth=0 -dNOPROMPT -sDEVICE=jpeg -dSAFER -dBATCH -dNOPAUSE -r140 -dJPEGQ=80  -dFirstPage='1' -dLastPage='8' -sOutputFile=/tmp/output/image-%d.jpg /tmp/downloads/sample.pdf

You can see output like this :

and your output folders will list your images :

FYI - Params :
-dFirstPage and -dLastPage specifies page limits , which is optional
-sOutputFile [output file] [input file]


No comments:

Post a Comment