Use Ghostscript to convert PCL to PostScript

Bryon picture Bryon · Jan 13, 2011 · Viewed 16.8k times · Source

So I want to use Ghostscript to convert files that are created in PCL format to PostScript.

That's the gist of my problem. I am simply trying to run it on the command line, but in the final stage it will have to be run on a lp command like lp -d < gs something something

GPL Ghostscript 9.00 (2010-09-14) I will be running this on a Solaris 10 server but I believe any Unix system should work similar.

bash-3.00# /usr/local/bin/gs -sDEVICE=pswrite     -dLanguageLevel=1     -dNOPAUSE -dBATCH -dSAFER     -sOutputFile=output.ps cms-form.pcl
GPL Ghostscript  9.00 (2010-09-14)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /undefined in &k2G-210z100u0l6d0e63fa0V
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1154/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 30
GPL Ghostscript  9.00: Unrecoverable error, exit code 1

Answer

Kurt Pfeifle picture Kurt Pfeifle · Jan 14, 2011

You are using Ghostscript (gs), which cannot read-in and interprete PCL.

You should use from GhostPDL the component that interpretes PCL: the executable is called pspcl6.

Then a command like

 pspcl6 ^
   -o out.pdf ^
   -sDEVICE=pdfwrite ^
    in.pcl

should convert your PCL to PDF. For PostScript Level 2 use -sDEVICE=ps2write.

However, it may be difficult to find pre-compiled binaries of pspcl6. It's not well known, despite it being part of the Ghostscript family of products. You may need to build + compile your own version from the sources.

Update: