Posts

Showing posts with the label Ghostscript

Call Ghostscript In Windows By Its Invocation Name?

Answer : There are several possibilities. To list the two most frequent ones: c:\full\path\to\gswin32c.exe should always work. For 64bit systems, use c:\full\path\to\gswin64c.exe . After a fresh installation using a standard windows installer, you may need to reboot before the updated %path% environment variable is used. Open a cmd window and (assuming your Ghostscript installation ended up in c:\path\to\gs ...) then type set path=c:\path\to\gs\gs9.02\bin;%path% . From this same cmd window you can now simply use gswin32c to start Ghostscript (use gswin64c on 64 bit Windows)...

Converting A PDF To PNG

Answer : You can use one commandline with two commands ( gs , convert ) connected through a pipe, if the first command can write its output to stdout, and if the second one can read its input from stdin. Luckily, gs can write to stdout ( ... -o %stdout ... ). Luckily, convert can read from stdin ( convert -background transparent - output.png ). Problem solved: GS used for alpha channel handling a special image, convert used for creating transparent background, pipe used to avoid writing out a temp file on disk. Complete solution: gs -sDEVICE=pngalpha \ -o %stdout \ -r144 cover.pdf \ | \ convert \ -background transparent \ - \ cover.png Update If you want to have a separate PNG per PDF page, you can use the %d syntax: gs -sDEVICE=pngalpha -o file-%03d.png -r144 cover.pdf This will create PNG files named page-000.png , page-001.png , ... (Note that the %d -counting is zero...