我做了很多工作,以找出将 XPS 文档转换为 PDF 的简便方法.有许多工具可以做到这一点,但它们并非免费的.有免费的替代品吗?
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?
推荐答案一个快速的Google搜索使我想到了: www.nathanpjones/wp/2013/03/output-to-pdf-in-wpf-for-free/
A quick google search led me to this: www.nathanpjones/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); }2个路径变量只是字符串.
The 2 path variables are just strings.
您需要引用以下两个dll: www.nathanpjones/wp/wp-content/uploads/2013/03/PdfSharpXpsBin.zip
You need to reference these 2 dll's: www.nathanpjones/wp/wp-content/uploads/2013/03/PdfSharpXpsBin.zip
非常感谢Nathan共享此信息!
Many thanks to Nathan for sharing this information!
内森作品以NuGet包的形式提供这里.
Nathan work is available as a NuGet package here.
更多推荐
是否有任何将XPS转换为PDF的开放工具?
发布评论