2 How can I convert PCL to PDF?
2.1 Answer
No, it’s not possible with Ghostscript itself…
But yes!, it’s very well possible with another cool piece of workhorse software from the same barn: its name ist GhostPCL.
Ghostscript developers in recent years integrated their sister products GhostXPS, GhostPCL and GhostSVG into their main Ghostscript source code tree, which switched from Subversion to Git some time ago. The complete family of products is now called GhostPDL. So all of these additional functionalities (load, render and convert XPS, PCL and SVG) are now available from there.
Previously, though GhostPCL was available as a source code tarball, it was hardly to be found on the ‘net. The major Linux distributions (Debian, Ubuntu, Redhat, Fedora, OpenSUSE,…) don’t provide packages for their users either. On MacPorts it is missing too.
This means you have to build the programs yourself from the sources.
You could even compile the so-called language switching binary, pspcl6.
This binary, in theory, can consume PCL, PDF and PostScript and convert this input to a host of other formats.
Just run make ls-product in the top level Ghostscript source directory in order to build it.
The resulting binary will end up in the ./language-switch/obj/ subdirectory. Run make ls-install in order to install it.
|
WARNING: While it worked for me whenever I needed it, Ghostscript developers recommend to stop using the language switching binary (since it’s ‘almost non-supported’ as they say, and it will possibly go away in the future). Instead they recommend to use the explicit binaries:
|
So for ‘converting PCL code to PDF format’ as the request reads, you could use the pcl6 command line utility, the PCL consuming sister product to Ghostscript’s gs (Linux, Unix, Mac OS X) and gswin32c.exe/gswin64c.exe (Windows) which are PostScript and PDF input consumers.
Sample commandline (Windows):
Sample Commandline (Linux, Unix, Mac OS X):
Explanation
-o output.pdf- The
-oparameter determines the location of the output. In this case it will be the file output.pdf in the current directory (since we did not specify any path prefix for the filename). At the same time, using-osaves us from typing-dBATCH -dNOPAUSE -dSAFER, because-oimplicitly does also set these parameters. -sDEVICE=pdfwrite- This parameter determines which kind of output to generate. In our current case it will be PDF. If you wanted to produce a multipage grayscale TIFF with CCITT compression, you would change that to
-sDEVICE=tiffg4(don’t forget to modify the output file name accordingly too:-o output.tif). -f input.pcl- This parameter determines which file to read as input. In this case it is the file input.pcl in the current directory.
Update: The Ghostscript website now at least for Windows users offers pre-compiled 32-bit binaries for GhostPCL and GhostXPS.
- http://downloads.ghostscript.com/public/binaries/ghostpcl-9.14-win32.zip
- http://downloads.ghostscript.com/public/binaries/ghostxps-9.14-win32.zip
See also the hints in *'[How can I convert XPS to PDF?](#convert-xps-to-pdf)'*.
TODO! Hint about the GhostPCL licensing. Esp. important: hint about the URW fonts which are not GPL (they require commercial licensing for commercial use).