22

Just installed Ghostscript 8.54 for Windows.

Does anyone know of the minimum parameters to pass to gswin32c.exe to make it convert, say, someFile.eps to someFile.eps.pdf?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
Chry Cheng
  • 3,378
  • 5
  • 47
  • 79

2 Answers2

36

Since the question was about the "minimum parameters to pass to gswin32c.exe to make it convert, say, someFile.eps to someFile.eps.pdf", let me give an answer:

  c:/path/to/gswin32c.exe ^
    -sDEVICE=pdfwrite ^
    -o c:/path/to/output.pdf ^
    c:/path/to/input.eps

or even shorter:

  gswin32c ^
    -sDEVICE=pdfwrite ^
    -o output.pdf ^
    input.eps

This will use the builtin, default parameters for Ghostscript. The most important of which, from the top of my head, for the most recent version of Ghostscript are:

  • -dPDFSETTINGS=/default ........ roughly the same settings as Adobe Distiller uses for "screen" with the following differences:
  • -r720x720 .................................. resolution: 720 dpi (bitmaps/fonts requiring conversion to bitmap)
  • -dColorConversionStrategy=/LeaveColorUnchanged ... (Distiller's "screen" uses =/sRGB)
  • -dCompatibilityLevel=1.4 .... (Distiller's "screen" uses =1.3)
  • -dEmbedAllFonts=true [*]......... (Distiller's "screen" uses =false)
  • -dOptimize=false [**] ............... (Distiller's "screen" uses =true)
  • -dDownsample{Color,Gray,Mono}Images=false ... (Distiller's "screen" uses =true)

[*] By default, Ghostscript does not embed the classical "Base 14"-PostScript fonts. To enforce that, use an extra parameter (at the end of the command line!) like -c "<</NeverEmbed [ ]>>setdistillerparams" -f c:/path/to/input.pdf.
[**] Ghostscript's pdfwrite device cannot "optimize" a PDF when it is writing it the first time. To optimize, you have to call Ghostscript again for a second pass, using special parameters (you may also try -dOptimize=true).

BTW, Ghostscript's most recent version is 8.71, available here: ghostscript.com/relases.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
  • 3
    Thanks, you saved me a decent bit of time. It's unfortunate that yours is not the selected answer. – David Apr 05 '12 at 19:07
  • Indeed, I wish this was the selected answer too. Btw "_-r720x720 . resolution: 720 dpi_" - 720? Ain't that a bit too much? Should it maybe be 72 instead? Cheers! – sdaau Jun 11 '12 at 21:59
  • 1
    @sdaau: The default resolution of Ghostscript's `pdfwrite` device *indeed* is 720 dpi. The default resolution of the image output devices (such as `tiffg4`, `jpeg`, `png`, `ppm`, `pbm`...) is 72 dpi. – Kurt Pfeifle Jun 12 '12 at 06:17
  • Hah, I would have never guessed that - thanks for the clarification, @pipitas ; cheers! – sdaau Jun 12 '12 at 09:42
  • 3
    @sdaau: You could ask a new SO question about how to find out *all* the default settings for any Ghostscript output device... and I'd answer that. Heh :-) – Kurt Pfeifle Jun 12 '12 at 13:27
  • Many thanks, @pipitas - I'd actually love to know that; question posted [here](http://stackoverflow.com/questions/11001107) `:)` - cheers! – sdaau Jun 12 '12 at 16:50
  • Thanks, this helped me, although depending on version of Ghostscript, `-o output.pdf` might not work - I had to use `-sOutputFile=output.pdf` – Dan May 02 '13 at 09:13
5

Under Windows, ps2pdf and other utilities are located in C:\Program Files\gs\gs#.##\lib as .bat and .cmd files. This isn't exactly obvious, especially if you're looking for .exe files.

arclight
  • 1,608
  • 1
  • 15
  • 19
  • 1
    what you say, is not necessarily true (but still helpful for some people). It all depends on what you chose when installing. A user (or his administrator) may have chosen a non-default path, or drive d:, when installing Ghostscript. and `c:\program files` is `c:\programme` on German installations. But you can overcome this by saying: *Usually, Ghostscript versions install into `%programfiles%\gs\gs#.##\*`*. Because %programfiles% is an environment variable that points to the default insta path on all locales, be it `c:\program files` or `d:\programme`... – Kurt Pfeifle Aug 11 '10 at 16:54