使用asp.net将XPS免费转换为PDF

问题描述 投票:3回答:1

我做了很多工作,以找出将XPS文档转换为PDF的简便方法。有许多工具可以做到这一点,但它们并非免费的。有免费的替代品吗?

c# asp.net wpf pdfsharp xps
1个回答
5
投票

谷歌快速搜索使我想到了这一点:http://www.nathanpjones.com/wp/2013/03/output-to-pdf-in-wpf-for-free/

在我剪掉一些不需要的代码后,我能够使它工作。结果如下:

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

2个路径变量只是字符串。

您需要引用这两个dll:http://www.nathanpjones.com/wp/wp-content/uploads/2013/03/PdfSharpXpsBin.zip

非常感谢Nathan共享此信息!

© www.soinside.com 2019 - 2024. All rights reserved.