views:

321

answers:

7

Does anyone know of an open source solution for generating multi-page PDFs from HTML server-side? iTextSharp etc. are all about composing page-by-page. Please don't suggest a PDF Printer.

I know of store-bought solutions that achieve this very well, but there has got to be a free component.

Regards.

A: 

This might help http://csharp-source.net/open-source/pdf-libraries

Sorantis
I've been up and down that page and many others without success.
Nissan Fan
A: 

Prince does just that, and generates beautiful outputs too. For example, to see how it deals with a page on wikipedia, try (after installing prince):

prince --no-author-style -s http://www.princexml.com/howcome/2008/wikipedia/wiki2.css http://en.wikipedia.org/wiki/Usa -o usa.pdf
Sinan Taifour
Prince is very good but I don't think it is either open source or free.
Steve Claridge
Oops, sorry, I had the impression it was open source.
Sinan Taifour
+1  A: 

XHTML2PDF/Pisa is a great Python project that does just want you want. It is dual licensed XHTML2PDF is dual-licensed with the GNU General Public License Version 2.0 (GPLv2) or a commercial license

Gourneau
It has worked flawlessly for me for the past year. I *HIGHLY* recommend it.
changelog
A: 

I am not sure if one such library is available for asp or .net but there is one Java library called PDFBox which is now in the Apache incubator project. You could give it a try

Ram
A: 

You can do it using XSLT-FO, then use fop to generate the PDF.

moin
+1  A: 

I'm not sure if you consider this a "PDF Printer", but I stumbled onto this one yesterday and it seems to work great.

http://code.google.com/p/wkhtmltopdf/

Here is a company's experience: http://beebole.com/en/blog/general/convert-html-to-pdf-with-full-css-support-an-opensource-alternative-based-on-webkit/

Please share any experiences you find from any of these answers. Good luck.

Thanks!

JP
Great find!! This is an epic solution. I can wrap this into something very useful with little effort.
Nissan Fan
A: 

Ubuntu Linux 10.04

  • $ html2ps -W b -U -u -O -n -o index.ps index.html
  • $ ps2pdf index.ps

For example from this file: GIMP 2.6it html.tar.bz2 online manual it generate a 1800 pages, 19 MB PDF crossliked single file. Open solutions work always better

Valerio