Ghostscript转换PDF到PCL与错误的方向



我有一个问题,试图使用Ghostscript将pdf文档转换为pcl文档。

原始pdf文档是横向的,所以pcl也应该是横向的。然而,在windows使用Ghostscript 9.14与以下命令函数:

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

同样的命令在Ubuntu Linux内核版本3.2.0-40-通用64位-但与Ghostscript 9.05 -导致错误的大小为A3的pcl文件,而不是A4的原始。

原始pdf文件包含windows字体"arial",在linux中也应该可用。linux上安装了"msttorcefont"包。这是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时,两种环境下的结果是相同的。

有没有人有过这样的经历或想法?

提前感谢并致以亲切的问候

如果没有看到原始的PDF文件,任何人都不可能提供帮助,所以我建议您打开一个错误报告并附加PDF文件。

几点观察:

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

开关-dFIXMEDIA应该是-dFIXEDMEDIA,同样,noragpagesize应该是norangpagesize

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

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

pdf2ps input.pdf output.ps

BUT:对于横向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

BUT:此命令基于ghostscript的Bug Bug 689919文档(参考http://bugs.ghostscript.com/show_bug.cgi?id=689919),仅当您安装了8.60或更高版本时才适用于面向肖像的文档。因为我有三个不同的环境,我可以批准,这个命令从8.60版本开始工作。我使用的是8.16、8.62和9.05版本。

对于8.62和9.05版本的ghostscript,这两个命令都可以正常工作pdf --> ps和pdf --> pcl的横向和纵向

最新更新