GhostScript 不能正确地将 PDF 文件打印到真正的打印机,但可以与 PDFCreator 一起正常工作

GhostScript does not print PDF file to a real printer correctly, but works fine with PDFCreator

我正在尝试使用 GhostScript 打印 PDF 文件,使用以下开关以及有效的输入文件路径: -dPrinted -dNOPAUSE -dNoCancel -dNOPROMPT -dNOSAFER -sDEVICE=mswinpr2 -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=%printer%printerName

如果我使用 PDFCreator,它可以正常工作并提供另一个输出 pdf 文件。但是当我使用真正的打印机时,图像全乱了。

这是我要打印的文件: https://drive.google.com/file/d/0ByL_VDOdxc3MbmpocEo0Vnhhd2c/view?usp=sharing 这是打印机输出的扫描件: https://drive.google.com/file/d/0B_KRzl3VVurjaTVIbkhkaUc0Y1E/view?usp=sharing

我尝试打印的 PDF 文件是由 PDFSharp 渲染的。 我在 Windows 8 上使用 GS version 9.15 32-bit,而我使用的真实打印机是 Brother Printer, model MFC-7840W。 此外,当我尝试将在 Google 上找到的通用示例 PDF 打印到真实打印机时,它工作正常。

有人知道是什么原因造成的吗? 提前致谢!

我的一位同事刚刚提醒我,几个月前我们 运行 遇到了一个相关问题 'might',并提出了一个解决方法,我相信可以解决那个问题.

mswinpr2 设备包含评论:

/* This driver uses the printer default size and resolution and
 * ignores page size and resolution set using -gWIDTHxHEIGHT and
 * -rXxY.  You must still set the correct PageSize to get the
 * correct clipping path.
 * The code in win_pr2_getdc() does try to set the printer page
 * size from the PostScript PageSize, but it isn't working
 * reliably at the moment.
 *
 * This driver doesn't work with some Windows printer drivers.
 * The reason is unknown.  All printers to which I have access
 * work.
 *
 * rjl 1997-11-20
 */

重要的一点是您必须设置 PageSize(以获得正确的剪辑)并使用 -g 开关设置图像的宽度和高度(以像素为单位)并正确设置打印机的分辨率使用-r。这可能需要一些实验......

您也可以考虑使用 gsprint,它是当前 GSView 的一部分。它具有打印方法的更新版本(由同一作者编写),据称是一种改进。

原来是PDF文件本身软掩码的问题。此问题已在 GhostScript 9.16 版中得到解决。