3 How can I to convert XPS to PDF?
3.1 Answer
Ghostscript developers in recent years have integrated a sister product named GhostXPS into their main Ghostscript source code tree, which is based on Git now. (They have also included two other products, named GhostPCL and GhostSVG.) 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 one location.
Unfortunately, none of the major Linux distributions (Debian, Ubuntu, Redhat, Fedora, OpenSUSE,…) do currently provide packages for their users. On MacPorts GhostXPS is missing too, as are GhostPCL and GhostSVG.
This means you have to build the programs yourself from the sources – unless you are a Windows user. In this case you are lucky: there is a *.zip container on the Ghostscript website, which contains a pre-compiled Win32 binary (which also runs on Windows 64 bit!):
While you’re at it and build the code yourself, you could even build a so-called language switching binary.
The Makefile has targets prepared for that.
This binary can consume PCL, PDF and PostScript.
It converts these input formats to a host of other file types.
Just run make ls-product && make ls-install in the top level Ghostscript source directory in order to get it installed.
|
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, also supported as build targets in the Makefile:
|
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 that’s PDF. If you wanted to produce a PostScript level 2 file, you would change that to
-sDEVICE=ps2write(don’t forget to modify the output file name accordingly too:-o output.ps). -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.
See also the hints in *['How can I convert PCL to PDF?'](#convert-pcl-to-pdf.html)*.
TODO! Hint about the GhostPCL licensing. Esp. important: hint about the URW fonts which are not GPL (they require commercial licensing for commercial use).