XPS转PDF有什么开源工具吗?

Is ther any open tool to convert XPS to PDF?

我进行了大量挖掘以找到一种将 XPS 文档转换为 PDF 的简单方法。有很多工具可以做到这一点,但它们不是免费的。有免费的替代品吗?

快速 google 搜索让我找到了这个: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 分享此信息!

编辑: Nathan 的作品可作为 NuGet 包使用 here