MinhTech.com

Yet another technology tutorial blog.

Convert XPS to PDF without Printer Driver via GhostPDL

By • Sep 4th, 2010 • Category: Windows

Here is how to convert XPS documents to PDF without an installed PDF distiller or printer driver.

This is especially useful if you lack Windows administrator privileges, such as on an employer-maintained workstation, and cannot install a PDF application or printer driver. If you have Microsoft Office installed, you can “print” into a XPS document with the Microsoft XPS Document Writer printer driver, and then convert it into PDF for easy distribution.

First, Download GhostPDL:

Go to Ghostscript’s Google Project Home and download the already compiled GhostPDL Windows binaries here. No compiling or installation is required. Simply uncompress the ZIP archive and you are ready to go.

Convert XPS to PDF via Command Line

Open a command prompt by going to Start > Programs > Accessories > Command Prompt, and then use the following syntax. You may also use the run prompt via Start > Run.

C:\gxps-871.exe -sDEVICE=pdfwrite -sOutputFile=myfile.pdf -dNOPAUSE myfile.xps

You may need to use absolute paths. Here I am using the gxps binary installed in the My Documents directory to convert a file on the Desktop.

C:\"C:\Documents and Settings\Minh Nguyen\My Documents\ghostpdl-8.71-win32\gxps-871.exe" -sDEVICE=pdfwrite -sOutputFile="C:\Documents and Settings\Minh Nguyen\Desktop\file.pdf" -dNOPAUSE "C:\Documents and Settings\Minh Nguyen\Desktop\file.xps"

is a technology junkie.
Email this author | All posts by

10 Responses »

  1. I have tried GXPS 8.71 and have found that it works great – up to a point.

    Unfortunately, I have XPS files, generated by XamlWriter.Save(Visual) of .NET Framework 3.0 that are, say, 1.6MB in size but when converted with GXPS are blown up to about 10 times that size: which is too much for my taste (also, the conversion takes an inordinate amount of computing, it seems to me).

    If, on the other hand, I use PDFCreator to convert that same XPS document to PDF I find that some glyphs are missing in the resulting PDF document.

    So, either way the conversion does not work for me. To sum up: I have not found a (free) XPS to PDF converter that does an adequate job for my perhaps a little funny XPS documents (they are generated from an InkCanvas element: it looks like GXPS finds it difficult to convert the XPS code resulting from ink).

  2. I am trying this out, but I get and error “Unable to open new driver.”
    what am I doing wrong?

    Using exactly your cmd line above with the GXPS-871.exe under window XP-Pro.
    thanks for any help.

  3. DavMittel, I got that error (Unable to open new driver) when I tried to run from a different directory. When I moved the document I was converting to the directory where pcl6-871 resides, the conversion worked.

    However, when converting from PCL to PDF, at various points in the PDF, lines were chopped horizontally. I haven’t figured out a solution for this, yet

  4. Nevermind the horizontal chopping. It was caused by Adobe Reader–there was nothing wrong with the PDF.

  5. Thank you for the post. It pointed me to the right executable for PCL to PDF conversion, the one I’ve tried was gxps-win32.exe and it did not render the document correctly.

  6. ÿþ|

  7. thanks. It is working for xps to pdf using gxps.exe

  8. Hi,

    This works great in most of the cases. However, this doesn’t work if the path has any spaces in between. For ex:
    C:\Documents and Settings\All Users\Application Data\sample app\sample.xps

    This doesn’t seem to pick the paths where there are spaces in it. It works well if I give just as c:\sample.xps.

    Any suggestions/workaround are greatly appreciated.

    Thanks,
    Ramesh

  9. Ramesh, please refer to my examples that use double quotation marks.

  10. When I open your RSS feed it gives me a ton of trash, is the issue on my side?

Leave a Reply