在运行时在 c # 中创建 pdf 文件

是否附有 pdf 格式的图书馆。NET 3.5允许在运行时创建 pdf 文件,例如打开一个新的 pdf 文件,逐行写入,嵌入图片等,并关闭所有在 C # 代码中的 pdf 文件?

我想要的是一套工具和规范,它们允许我在 C # 中实现自定义的 pdf 编写器,而无需使用 ReportingServices 的 pdf 输出选项。

138108 次浏览

iTextSharp http://itextsharp.sourceforge.net/

Complex but comprehensive.

itext7 former iTextSharp

I have used (iTextSharp) in the past with nice results.

I strongly recommend: iTextSharp

How about iTextSharp?

iText is a PDF (among others) generation library that is also ported (and kept in sync) to C#.

Well, free and not-for-free, I use WebSuperGoo ABCpdf .NET component, that I just love it!

not-for-free because you need to pay for it.

for free because even if you have to pay, they have a trial version and you can request a free license if you do not mind that, in your site show "This site uses WebSuperGoo ABCpdf .NET component" with a link to their website.

I did that and I got a free license (version 5 in that time) so, I can say that it works (even if the website is no longer online) - I still have and use the component ~:)

A wonderful thing that I love with this is that you can do everything that you can thing off with this, create PDF forms and dynamically fill them and send to user by mail or have them to download it, create a pdf from scratch, convert HTML pages into PDF, etc etc etc, please read the documentation, it is a wonderful component.

Have a look at PDFSharp

It is open source and it is written in .NET, I use it myself for some PDF invoice generation.

For this i looked into running LaTeX apps to generate a pdf. Although this option is likely to be far more complicated and heavy duty than the ones listed here.

I have used Gnostice in the past and found them to be very good.

http://www.gnostice.com/PDFOne_dot_Net.asp

iTextSharp is no longer licensed under the MIT/LGPL license. Versions greater than 4.1.6 are licensed under the Affero GPL, meaning you can't even use it in a SaaS (Software as a Service) scenario without licensing your code under the GPL, or a GPL-compatible license.

Other opensource PDF implementations in native .NET include

There's also a couple of Java PDF libraries (like PDFBox) you can convert to .NET using IKVM.

Docotic.Pdf library can be easily used to create PDF files at runtime. The library can also modify existing PDF documents (extract text/images, append pages, fill form fields, etc.)

Samples for common tasks are available on the library site.

Disclaimer: I work for Bit Miracle.

Amyuni PDF Converter .Net can also be used for this. And it will also allow you to modify existing files, apply OCR to them and extract text, create raster images (for thumbnails generation for example), optimize the output PDF for web viewing, etc.

Usual disclaimer applies.

There is a new project, RazorPDF which can be used from ASP.NET MVC. It is available as nuget package (search for RazorPDF).

Here is more info: http://nyveldt.com/blog/post/Introducing-RazorPDF

IMPORTANT UPDATE as @DenNukem pointed out, it depends on iTextsharp, I forgot to edit answer when I found that out (when I tried to use it), so if your project is not open source and eligible for their AGPL licence, it will probably be too expensive to use.