Please recommend a good library for programmatically creating PDF documents in .NET applications.
Try PDFsharp and MigraDoc, it is an open source PDF creation component written in .net
Here is a nice list of commercial solutions: http://www.411asp.net/home/assembly/document/pdf
I have used DynamicPDF on a few sites, with very good results.
Have you looked at http://sourceforge.net/projects/itextsharp/? I have used the Java version on a project and it worked well.
There is also a product called ABCpdf from a company called WebSupergoo. There's a free license available as long as you link back to their site or you can buy a license and not have to link to them. I used the control for a web application which generated forms for a mortgage company and it worked very well.
I've used Report .Net with some success. It's free and the code makes sense to me, which is almost as important.
I've been using ActivePDF for years and it seems to be very stable and quite powerful. Simply draw out your fields in Acrobat pro and programmatically prefill them with text, images, just about anything.
It would appear there is no shortage of choices.
Microsoft SQL Server Reporting Services can accomplish this, and exposes the functionality through an API you can code against.
We use DynamicPDF from CeTe (http://www.cete.com/). You can use this to either render a PDF from scratch, or pull pages of content in from an existing PDF and draw over the top.
It also has a report designer that you can use with some data binding features to help automate things a little (although I haven't actually tried that bit yet!).
It's been quite simple to use and pretty trouble-free to date.
I've used ITextSharp to create PDF's from .net. It is the .net port of the open source IText. It has the capability to create the PDF from scratch. But doing that would require formatting the entire document. Instead I created a PDF Form, then filled in the fields of the form using a small class. The most difficult time I had was figuring out how to get the the filled in form into the actual memory stream. The work of the class is in the following function. I can give more details if someone wants them. The sourceforge url is: http://sourceforge.net/projects/itextsharp/
Public Function GeneratePDF() As IO.MemoryStream
Dim pdfTemplate As PdfReader
Dim stamper As PdfStamper
Dim tempPDF As PdfReader
Dim doc As Document
Dim msTemp As MemoryStream
Dim pCopy As PdfCopy
Dim msOutput As New MemoryStream
pdfTemplate = New PdfReader(m_FormName)
doc = New Document
pCopy = New PdfCopy(doc, msOutput)
doc.Open()
For Each pg As FormPage In FormPages
msTemp = New IO.MemoryStream
pdfTemplate = New PdfReader(m_FormName)
stamper = New PdfStamper(pdfTemplate, msTemp)
For Each fld As FormField In pg.Fields
stamper.AcroFields.SetField(fld.fieldName, fld.fieldValue)
Next
stamper.FormFlattening = True
stamper.Close()
tempPDF = New PdfReader(msTemp.ToArray)
pCopy.AddPage(pCopy.GetImportedPage(tempPDF, pdfTemplate.NumberOfPages))
pCopy.FreeReader(tempPDF)
Next
doc.Close()
Return msOutput
End Function
The company that I work for is using Rubika from Solimar Systems. I believe that they also use itextsharp in there "PDFEngine". We create hundreds of pdfs with thousands of pages per month with this software.
If you're going to use iTextSharp (or its original Java incarnation, iText), you owe it to yourself to find a copy of iText In Action: Creating and Manipulating PDF by Bruno Lowagie, the creator of iText. It's very well-written and contains great explanations for why PDF does things the way it does. (I have no financial interest; I just thought it was one of the better-written technical books I've read.)
I haven't used it myself, but I've heard good things about Prince. There's a .Net interface available for it.
If you don't want to mess around in all the "PDF dirt" yourself then PDFTron is prety good. One draw back it is not free, although it is an easy to use .Net PDF library that will get you up and running quickly.
We're using TallPDF from TallComponents and have had great success with it. Not sure what the other libraries uses, but it is using xslt as templates for the pdfs which makes it easy to adjust/update templates on a live server.
I highly recommend Ibex PDF Creator from Visual Programming Limited. It uses standard XML:FO to create high-quality PDF documents. The libary has many features, and the vendor provides excellent support. The tool is licensed per developer so you can redistribute it without any licensing concerns.
Expanding on ActivePDF, if you have to make PDF files of Microsoft Office documents and you have a server you can install Microsoft Office on (i.e., a server in the cluster which isn't otherwise Internet connected) then ActivePDF's DocConverter is almost literally the only game in town. It's pretty easy to use and has lots of .NET assemblies to work with.
I have had good experiences with PrinceXML. It generates a .PDF from a .HTML file, which sounds like a hack at first, but their rendering engine is very good. Passes acid2 and has good .svg support so you can include vector images instead of bitmaps to keep the .PDF relatively small (which is important when generating reports which need to be sent as an attachment).
Especially if you have in-house designers who speak html/css they will have no trouble at all creating a good looking .pdf, so IMO it's a perfect match if you're doing web applications.
PDFLib - As you can see there are several vendors in this space. I think that it all depends on how you intend to integrate it in your application. For instance a few years a go I developed and application in .Net utilizing PDFLib on account that the client wanted to create a web based application that created design proofs and also provided optimization for their digital print services. Looking back at the project I wish I would have known about Dynamc PDF's suite of products.
PDFLib - I have not found PDF feature that could not be generated using PDFLib. OTOH I have not found a PDFLib feature that I could use without reading the documentation twice.
I like to use GhostScript. It lets you convert PostScript files to PDF format. Plus it is free to use at no charge.
I've also used DynamicPDF and it is an excellent product. Very easy to use, and it has a very object-oriented structure. It impressed the hell out of me. It has a boatload of features, including the ability merge together multiple PDF documents.
It's not free, but I think you should check out the trial.
Regards...
You can also give Telerik Reporting a try. It can export to PDF as well.
I have tried all of those programs, but none of them worked for what I was doing.
I needed to export a complicated HTML report into a PDF format.
The only tool that I found that actually rendered the report from HTML and accurately rendered it (using the CSS styles, classes, and complicated divs and tables) was a tool called Winnovative HTML to PDF Converter for .NET
Crystal Reports can be programmed so that it outputs PDF files. Works perfect! I have developed a system that generates about 500 PDF per day for archiving. Crystal Reports even comes with Visual Studio so should be available for most. See example below:
using CrystalDecisions.CrystalReports.Engine;
ReportDocument rptCust;
string sDate_time;
string sDestination_path;
CrystalDecisions.Shared.ExportOptions myExportOptions;
CrystalDecisions.Shared.DiskFileDestinationOptions File_destination;
CrystalDecisions.Shared.PdfRtfWordFormatOptions Format_options;
myExportOptions = new CrystalDecisions.Shared.ExportOptions();
File_destination = new CrystalDecisions.Shared.DiskFileDestinationOptions();
Format_options = new CrystalDecisions.Shared.PdfRtfWordFormatOptions();
sDate_time = DateTime.Now.ToString("ddMMyyyyHHmmssff");
sDestination_path = sDestination_file + sPolicy_number + sPolicy_number1 + "-" + sDate_time + ".pdf";
File_destination.DiskFileName = sDestination_path;
myExportOptions = rptCust.ExportOptions;
myExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
myExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
myExportOptions.DestinationOptions = File_destination;
myExportOptions.FormatOptions = Format_options;
rptCust.Export();
I've been using iTextSharp coupled with Adobe LiveCycle Designer. Its very simple and easy to use. I have an entry on my blog about it - http://jesal.us/blog/index.php/2008/10/10/create-pdf-forms-using-itextsharp/
I'm surprised that nobody has mentioned SQL Server Reporting Services.
I haven't used it in production, but it has seems to have quite a lot of nice features including a very good GUI report builder, extensibility through .NET, web services (SOAP) and web portal (WWW) interfaces, report generation on a schedule or on demand, report caching, e-mail reports (on demand or schedule) or view on-line, and can render to PDF, HTML, Excel, and Image.
PDF Duo .Net is a small but very effective component for converting HTML to PDF.
I advise you to try PDF Metamorphosis .Net, it can be used in any .Net application to:
- export HTML to PDF
- export RTF to PDF
- Split and Merge PDF documents
This is 100% C# solution, can be used everywhere in .Net.
While probably overkill for the simple task of generating a PDF, ActiveReports has been generating PDFs since 1996 and is a very mature PDF generator. It has many advantages over a simplistic PDF library if you need to add data to your documents, it is interesting to target formats other than PDF, or you want a visual designer. Recently in version 6, we also added advanced PDF features like digital signatures and PDF timestamps in addition to the existing PDF security features (encryption, password, etc.).
Since you are a .NET developer I would suggest using standard .NET (WPF) API to generate dynamic Flow documents (which as based on XAML). This is similar to HTML but is more powerful. For more info you can search for "FlowDocument" in MSDN.
You can serailize Flow documents or XAML to PDF using PDFTron's PDFNet SDK (or XPS2PDF). See Xaml2PDF sample in PDFNet SDK: http://www.pdftron.com/pdfnet/samplecode.html#XAML2PDF
Just to be complete, often overlook You can actually use office automation and create word 2007 document and save it as PDF. If you are using older word version, you can print it to any PDF printer driver like PDFCreator or JawsPDF.
I've used both Syncfusion's EssentialPDF and ceTe's DynamicPDF. Each has capabilities the other does not, so which is best to use for your specific situation depends heavily on what your PDF documents must contain.
Not sure if Zack has solidified on anything with this particular need, but I've been working on a way to render RDL files (SSRS Report Files) without the need to deploy SSRS, as I had a few applications where I needed a great reporting format (SSRS Reports), but couldn't expect the end-users to deploy and manage SSRS... Using the 2010 version of the associated libs, you can export in Word, Excel, and PDF, so this should more than fulfill your need.
You can download the source from CodePlex.
Word of note: I haven't gotten into subreports to-date, and am looking to do that feature at some point. If anyone is interested in tackling it, please let me know.