0

我在尝试使用 Ghostscript 将 pdf 文档转换为 pcl 文档时遇到问题。

原始 pdf 文档是横向的,因此 pcl 也应该是横向的。尽管如此,在使用具有以下命令功能的 Ghostscript 9.14 的 Windows 中:

gswin32 -dNOPAUSE -dBATCH -sDEVICE=ljet4 -dSAFER -dAutoRotatePages=/NONE -sPAPERSIZE=a4 -sOutputFile=./convert_windows.pcl ./duplicate_windows.pdf

Ubuntu Linux 内核版本 3.2.0-40-generic 64 位(但使用 Ghostscript 9.05)中的相同命令会导致大小为 A3 而不是 A4 的错误定向 pcl 文件作为原始文件。

原始的 pdf 文件包含 windows 字体“arial”,它也应该在 linux 中可用。软件包“msttorcefonts”安装在 linux 上。这是 Ghostscript 字体图的简短摘录:

cat /usr/share/ghostscript/9.05/Resource/Init/Fontmap.GS

给出:

% This font, and only this font among the Hershey fonts, uses
% the SymbolEncoding.

/Hershey-Symbol                         (hrsyr.gsf)     ;       % 5066567

/Arial                                  /ArialMT                ;
/Arial,Bold                             /Arial-BoldMT           ;
/Arial,Italic                           /Arial-ItalicMT         ;
/Arial,BoldItalic                       /Arial-BoldItalicMT     ;

以下清单显示了 linux 命令行的输出,它与 windows Ghostscript 控制台的输出相同!

GPL Ghostscript 9.05 (2012-02-08)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Loading NimbusMonL-Bold font from /usr/share/fonts/type1/gsfonts/n022004l.pfb... 3627296 2211468 1767360 473754 3 done.
Loading NimbusSanL-Bold font from /usr/share/fonts/type1/gsfonts/n019004l.pfb... 3668288 2319461 1807728 497748 3 done.
Loading NimbusSanL-Regu font from /usr/share/fonts/type1/gsfonts/n019003l.pfb... 3800176 2466391 1827912 512832 3 done.
Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 3964224 2617715 1969200 654805 3 done.
Page 2

我已经尝试了几个 Ghostscript 的选项,比如

-dFIXEDMEDIA
-dNORAGEPAGESIZE

和别的。

将 pdf 文档转换为 ps 时,两种环境的结果相同。

有没有人有这个问题或想法的经验?

预先感谢和亲切的问候

4

2 回答 2

0

如果没有看到原始 PDF 文件,任何人都不太可能提供帮助,因此我建议您打开错误报告并将 PDF 文件附在此处。

几点观察:

-dAutoRotatePages 仅在创建 PDF 文件时有效,在解释文件时无效。

开关 -dFIXMEDIA 应该是 -dFIXEDMEDIA,同样 NORAGEPAGESIZE 应该是 NORANGEPAGESIZE

于 2014-06-03T13:26:19.337 回答
0

这可能是一个可能的解决方案,适用于我的情况。前提条件:Ghostscript 8.6.0 或更高版本!

将 pdf 转换为 ps 不是使用 gs 命令,而是使用 gs 包装器pdf2ps,它是 ghostscript 包的一部分:

pdf2ps input.pdf output.ps

但是:对于横向 pdf 文档,这仅适用于 8.60 或更高版本!否则横向文档将以纵向打印。

使用以下命令将 pdf 转换为 pcl 对我有用:

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=a4 -sOutputFile=output.pcl -c "<< /InputAttributes << currentpagedevice /InputAttributes get { pop null } forall >> dup 0 << /PageSize [ 595 842 ] >> put >> setpagedevice" save pop -f input.pdf

但是:此命令基于 Ghostscript 的错误错误 689919 的文档(请参阅http://bugs.ghostscript.com/show_bug.cgi?id=689919),并且仅当您安装了一个版本时才适用于纵向文档8.60 或更高。因为我可以批准三种不同的环境,所以这个命令从 8.60 版开始有效。我使用了 8.16、8.62 和 9.05 版本。

对于 ghostscript 8.62 和 9.05 版本,这两个命令都适用于 pdf --> ps 和 pdf --> pcl 用于横向和纵向。

于 2014-06-03T18:16:20.420 回答