Question

I have an issue trying to convert a pdf document to a pcl document using Ghostscript.

The original pdf document is landscape and so the pcl should be as well. Nevertheless in windows using Ghostscript 9.14 with the following command functions:

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

The same command in Ubuntu Linux Kernel Version 3.2.0-40-generic 64 bit - but with Ghostscript 9.05 - results in a wrong orienteated pcl file of size A3 instead of A4 as the original.

The original pdf file contains windows font "arial", which should be available in linux as well. The package "msttorcefonts" is installed on linux. This is an short extract of the fontmap of Ghostscript:

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

gives:

% 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     ;

The following listing shows the output of the linux command line, which is the same output as from the windows Ghostscript console!

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

I alredy tried several options of Ghostscript like

-dFIXEDMEDIA
-dNORAGEPAGESIZE

and others.

When converting the pdf document to ps the result is the same on both environments.

Does anyone has experiences with that issue or an idea?

Thanks in advance and kind regards

Was it helpful?

Solution 2

This may be a possible solution, which works in my case. Precondition: Ghostscript Version 8.6.0 or higher!

Converting pdf to ps not with gs command, but with gs wrapper pdf2ps, which is part of the ghostscript package:

pdf2ps input.pdf output.ps

BUT: For landscape pdf documents this works only since version 8.60 or higher! Otherwise landscape documents will be printed in portrait.

Converting pdf to pcl worked for me using the following command:

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: This command is based on the documentation of Bug Bug 689919 of ghostscript (refer to http://bugs.ghostscript.com/show_bug.cgi?id=689919) and works for portrait-orientated documents only if you have installed a version 8.60 or higher. Because I have three different environments I can approve, that this command works since version 8.60. I used Versions 8.16, 8.62 and 9.05.

For versions 8.62 and 9.05 of ghostscript both commands worked properly for pdf --> ps and pdf --> pcl for landscape and portrait.

OTHER TIPS

Its unlikely anyone can help at all without seeing teh original PDF file, so I would suggest that you open a bug report and attach the PDF file there.

A few observations:

-dAutoRotatePages only has an effect when creating a PDF file, not when interpreting one.

The switch -dFIXMEDIA should be -dFIXEDMEDIA, likewise NORAGEPAGESIZE should be NORANGEPAGESIZE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top