Creating pdf files at runtime in c#
Is there a pdf library attached/that can be attached to .NET 3.5 that allows creation of pdf files at runtime i.e opening a new pdf file, writing to it line by line, embedding images, etc and closing the pdf file all in C# code?
What I want is a set of tools and specifications which allow me to implement a customised pdf writer in C# without using Reporting Services' pdf output option.
Complex but comprehensive.
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
- PDF Clown (make sure you get the patches to the latest version)
- PDFJet open source edition (commercial version also available, and you will need the JDK installed to build this)
There's also a couple of Java PDF libraries (like PDFBox) you can convert to .NET using IKVM.
Have a look at PDFSharp
It is open source and it is written in .NET, I use it myself for some PDF invoice generation.
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.
I strongly recommend: iTextSharp
I have used (iTextSharp) in the past with nice results.
I have posted a sample of how to use iTextSharp in one of my blogs:
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.
How about iTextSharp?
iText is a PDF (among others) generation library that is also ported (and kept in sync) to C#.
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.
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.