windows 用于将 EPS 转换为 PDF 的 Ghostscript 命令行参数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/785436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:16:57  来源:igfitidea点击:

Ghostscript command line parameters to convert EPS to PDF

windowscommand-lineparametersghostscript

提问by Chry Cheng

Just installed Ghostscript 8.54 for Windows.

刚刚为 Windows 安装了 Ghostscript 8.54。

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

有没有人知道要传递给gswin32c.exe它的最小参数,例如someFile.eps转换为someFile.eps.pdf

回答by Kurt Pfeifle

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:

由于问题是关于“传递给 gswin32c.exe 以使其转换的最小参数,比如说,someFile.eps 到 someFile.eps.pdf”,让我来回答:

  c:/path/to/gswin32c.exe ^
    -sDEVICE=pdfwrite ^
    -o c:/path/to/output.pdf ^
    c:/path/to/input.eps
  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
  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:

这将使用 Ghostscript 的内置默认参数。在我的脑海中,对于最新版本的 Ghostscript,其中最重要的是:

  • -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)
  • -dPDFSETTINGS=/default........与 Adob​​e Distiller 用于“屏幕”的设置大致相同,但有以下区别:
  • -r720x720................................. 分辨率:720 dpi(位图/字体需要转换为位图)
  • -dColorConversionStrategy=/LeaveColorUnchanged...(蒸馏器的“屏幕”使用=/sRGB
  • -dCompatibilityLevel=1.4....(蒸馏器的“屏幕”使用=1.3
  • -dEmbedAllFonts=true[*].........(蒸馏器的“屏幕”使用=false
  • -dOptimize=false[**] ...............(蒸馏器的“屏幕”使用=true
  • -dDownsample{Color,Gray,Mono}Images=false...(蒸馏器的“屏幕”使用=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 pdfwritedevice 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).

[*] 默认情况下,Ghostscript 不嵌入经典的“Base 14”-PostScript 字体。要强制执行此操作,请使用一个额外的参数(在命令行的末尾!),例如-c "<</NeverEmbed [ ]>>setdistillerparams" -f c:/path/to/input.pdf.
[**] Ghostscript 的pdfwrite设备在第一次写入 PDF 时无法“优化”它。要优化,您必须使用特殊参数再次调用 Ghostscript 进行第二次传递(您也可以尝试-dOptimize=true)。

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

顺便说一句,Ghostscript 的最新版本是 8.71,可在此处获得:ghostscript.com/relases

回答by arclight

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

在 Windows 下,ps2pdf 和其他实用程序位于C:\Program Files\gs\gs#.##\lib.bat 和 .cmd 文件中。这不是很明显,特别是如果您正在寻找 .exe 文件。