Programmatically print to a PDF printer [closed]

梦想与她 提交于 2019-12-20 04:31:36

问题


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.


回答1:


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.

Hope this helps!



来源:https://stackoverflow.com/questions/14162392/programmatically-print-to-a-pdf-printer

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