Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is ther any open tool to convert XPS to PDF? [closed]

Tags:

c#

wpf

pdfsharp

xps

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?

like image 752
Bolo Avatar asked Mar 17 '15 19:03

Bolo


People also ask

How do I open XPS files without XPS Viewer?

For Google Drive users, upload the XPS file to your Drive. Then, double-click the file to open it. Alternatively, try an online XPS-to-PDF file converter to view the content as a PDF.

What program opens .XPS files?

How to open an XPS file. Windows users can open XPS files in Microsoft XPS Viewer. In Windows 11 and later versions of Windows 10, you must manually install XPS Viewer by going to Settings → Apps → Optional features → Add an optional feature and searching for XPS Viewer.

Can you open XPS with Adobe?

1 Correct answer. Adobe Acrobat does not support opening of XPS files. It does support creating a new PDF file from an XPS file, although that function is not supported via command line. Adobe Acrobat does not support opening of XPS files.


1 Answers

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.

like image 98
Bolo Avatar answered Oct 17 '22 17:10

Bolo