tags:

views:

320

answers:

6

Are there any good tutorials or guides on the web for creating PDF files programmatically? I am especially thinking of discussing best practices in a language-agnostic way, though something tied to a language could also be useful.

Do PDF libraries tend to have multiple APIs for different languages or are they usually tied to one particular technology?

I have used FPDF in the past and it served its purpose, but I would certain like to know if people have had success with other libraries and techniques.

+4  A: 

The only pdf library I've personally worked with is iText. Its a Java library that's free and there is a pretty cheap ebook available with lots of good examples, but its free to use if you want to figure out how to use it on your own. I believe I read somewhere that it has also been ported to some other languages as well. Wikipedia says C#, C++, and J#.

I found it very easy to use and very well documented, but my use case was a pretty straightforward one, nothing too complicated, so it may not have been a good test of the libraries capabilities.

shsteimer
+1 iText is also used in Google spreadsheet among others.
tovare
+1  A: 

You could try fop (formatted objects processor) from apache - it is an xsl based system that I have used before to create pdf reports of data.

Ronnie
+1  A: 

There are some very good examples for using the C# port of iText at http://itextsharp.sourceforge.net/tutorial/index.html

I presume the syntax is similar across the various ports.

I also found it was very useful to generate the documents as HTML and then use the iText methods to convert HTML to PDF as working in PDF chunks isn't very natural (though it is closer to the underlying implementation of the file format).

DavidWhitney
+1  A: 

I use the ActivePDF toolkit (.NET), http://www.activepdf.com/. I've used it on several project with great success. It is not free, but not too bad. Very good for creating/reading/filling online forms.

Tim Cochran
+2  A: 

Here is a google techtalk about Prince a system for generating high quality PDF from HTML and CSS. And see the http://www.princexml.com/.

I've used FOP from Apache for creating PDF from a Java web application. I had decent results but knew before hand I wasn't going to do anything too demanding (mailing labels). Fop is not as good as commercial products for formatting to PDF. The FOP website has a decent quick start guide, and other resources you need to know about XSL-FO. Check out their resources page.

The best commercial product I've used is Arbortext. The source documents are in SGML or XML and I've generated many PDF books using Arbortext and stylesheets. The results have been very good. Arbortext is also an excellent authoring environment for SGML/XML.

caerwyn
+1  A: 

The PDF Module in Perl has decent documentation and is relatively easy to use if you know Perl. The perldoc page has some examples too.

Abhinav