我有一个问题尝试使用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-generic 64位中的相同命令 - 但是ghostscript 9.05 - 结果在尺寸A3的错误Oriented PCL文件中而不是A4作为原件。

原始PDF文件包含Windows字体“Arial”,也应在Linux中使用。 Package“msttorcefonts”安装在Linux上。这是GhostScript FontMap的简短提取物:

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
.

我alredy尝试了几个选项的ghostscript,如

-dFIXEDMEDIA
-dNORAGEPAGESIZE
.

和其他。

将PDF文档转换为PS,结果在两个环境中都是相同的。

有人是否有那个问题或想法的经历?

提前感谢和善意的条文

有帮助吗?

解决方案 2

这可能是一个可能的解决方案,在我的情况下工作。 precondition:ghostscript版本8.6.0或更高版本!

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

pdf2ps input.pdf output.ps
.

但是:景观PDF文件只有自版本为8.60或更高版本!否则景观文档将在肖像中打印。

使用以下命令将PDF转换为PCL为ME工作:

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用于横向和肖像。

其他提示

它不太可能有任何人都可以帮助所有没有看到原始PDF文件,所以我建议您打开一个错误报告并在那里附加PDF文件。

几个观察结果:

-dautorotatepages仅在创建PDF文件时具有效果,而不是在解释一个时。

Switch -dfixmedia应该是-dfixedmedia,同样是NoragePageSize应该是NorangePageSize

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top