Convert XPS to PDF in WPF C# application

时光总嘲笑我的痴心妄想 提交于 2019-12-01 09:13:57

问题


I need to convert an XPS file I create with my application to a PDF file, what is the best way to do so? I prefer this to be done from inside C# using a managed assembly.

Open source is preferred upon third party solutions


回答1:


You can use the XpsDocument class to read the XPS files, then use a PDF library (such as Report.Net or #PDF) to export it. I used #PDF back in .NET 1.1, but not sure if it can be easily converted to .NET 2.0.

#PDF: http://sharppdf.sourceforge.net/

Report.NET: http://report.sourceforge.net/




回答2:


An open source managed assembly might be hard to find, but you can look at tallcomponents.com for a commercial product that might help, You can have a look at GhostScript.com, its open source and supports both XPS and PDF, although you may have issues redistributing it without a license.




回答3:


Although it is not free, Amyuni PDF Creator .Net supports loading XPS files and saving them as PDF.

Usual disclaimer applies.



来源:https://stackoverflow.com/questions/6395874/convert-xps-to-pdf-in-wpf-c-sharp-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!