编程打印到PDF打印机 [英] Programmatically print to a PDF printer

查看:238
本文介绍了编程打印到PDF打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一个免费开源的基于.NET,的优选为C#的,PDF打印机,如CutePDF的的自定义PDF作家用编程的方式访问,让我到一个XPS文档保存为PDF格式。我发现,能够XPS转换为PDF文件格式很多办法,但他们不是开源的。我很好奇,想知道是否有人知道一个开放源码库,可以让我做到这一点的。

I am looking for a free open source .Net based, preferably C#, pdf printer such as CutePDF's Custom PDF Writer with programmatic access that will allow me to save a xps document to a pdf format. I have found many alternatives that are capable of converting xps documents to pdf formats, but they are not open source. I was curious to know if anyone is aware of an open source library that will allow me to accomplish this.

推荐答案

有关的任​​何你在那里尝试使用一个开源意味着XPS转换为PDF格式,我是能够成功地做到这一点使用 PDFSharp 1.31版。它成功升级到.NET 4.5和我包括PdfSharp.Xps项目到我的解决方案。一旦你包括所有的引用,你只需要一行链接到您的XPS文件。

For any of you out there attempting to convert XPS to PDF using an open source means, I was able to successfully do so using PDFSharp version 1.31. It successfully upgraded to .NET 4.5 and I included the PdfSharp.Xps project into my solution. Once you include all the references, you only need a single line to link to your XPS file.

XpsConverter.Convert(D:\\Example\\test.xps);

注:也有其他可用的构造函数,但是我用的是最简单的之一,我的例子。

Note: There are also other constructors available but I used the most simplistic one in my example.

希望这有助于!

这篇关于编程打印到PDF打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆