Is ther any open tool to convert XPS to PDF?

Bolo picture Bolo · Mar 17, 2015 · Viewed 8.6k times · Source

I did a lot of digging to figure out an easy way to convert an XPS document into a PDF. There are many tools that can do this but they are not free. Is there a free alternative?

Answer

Bolo picture Bolo · Mar 17, 2015

A quick google search led me to this: http://www.nathanpjones.com/wp/2013/03/output-to-pdf-in-wpf-for-free/

I was able to get it to work after I trimmed down some of the code I did not need. Here is the result:

using (PdfSharp.Xps.XpsModel.XpsDocument pdfXpsDoc = PdfSharp.Xps.XpsModel.XpsDocument.Open(xpsPath))
{
    PdfSharp.Xps.XpsConverter.Convert(pdfXpsDoc, pdfPath, 0);
}

The 2 path variables are just strings.

You need to reference these 2 dll's: http://www.nathanpjones.com/wp/wp-content/uploads/2013/03/PdfSharpXpsBin.zip

Many thanks to Nathan for sharing this information!

Edit: Nathan work is available as a NuGet package here.