Is ther any open tool to convert XPS to PDF?

别来无恙 提交于 2020-06-21 04:39:47

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/29108319/is-ther-any-open-tool-to-convert-xps-to-pdf

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