C# PDF 打印库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/430941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 03:06:23  来源:igfitidea点击:

C# PDF Printing Library

c#htmlpdfpdf-generation

提问by Adam Haile

Are there any free libraries that would "print" to a PDF without actually having to install a PDF printer on the system. I want something that can be completely self contained in my application. The reason I say I want it to "print" is that I've tried and tried to find a solution for directly converting from HTML with CSS to PDF, but it does't seem very possible. So I want to use the System.Windows.Forms.WebBrowser control to render the page first and then output that rendering to PDF. I just don't want the user to be required to install a PDFPrinter.

是否有任何免费库可以“打印”到 PDF,而实际上不必在系统上安装 PDF 打印机。我想要一些可以完全独立于我的应用程序的东西。我说我希望它“打印”的原因是我已经尝试并试图找到一种直接从带有 CSS 的 HTML 转换为 PDF 的解决方案,但这似乎不太可能。所以我想使用 System.Windows.Forms.WebBrowser 控件首先呈现页面,然后将该呈现结果输出为 PDF。我只是不希望用户被要求安装 PDFPrinter。

采纳答案by Dmitri Nesteruk

回答by Marc Gravell

Does it have to be free? Last time I looked at ABCpdfit looked quite good, and claims to support css (here).

它必须是免费的吗?上次我看ABCpdf 时,它看起来相当不错,并声称支持 css(这里)。

HTMLDOCshould support css at some point, but last time I checked the css stuff was still in beta. And has been for "some time"; I've given up waiting... It isn't .NET, but you can use Processto invoke it.

HTMLDOC应该在某个时候支持 css,但上次我检查 css 的东西仍处于测试阶段。并且已经“有一段时间”了;我已经放弃等待...它不是 .NET,但您可以使用Process它来调用它。

回答by JoshBerke

http://www.html-to-pdf.net/- This isn't free but its preety cheap and effective. I am using it now to convert HTML with CSS to PDF. Essentially we display the page to the user and then with a click of a button they can download a PDF of the page.

http://www.html-to-pdf.net/- 这不是免费的,但它非常便宜和有效。我现在使用它来将带有 CSS 的 HTML 转换为 PDF。本质上,我们向用户显示页面,然后通过单击按钮,他们可以下载该页面的 PDF。

回答by Steve

http://itextsharp.sourceforge.net/is really excellent. You can see how to use it in the repository at stochfit.sourceforge.net

http://itextsharp.sourceforge.net/真的很棒。您可以在 stochfit.sourceforge.net 的存储库中查看如何使用它

回答by Glen Little

Another tool (not free): http://www.winnovative-software.com/

另一个工具(不是免费的):http: //www.winnovative-software.com/