views:

878

answers:

10

Hi,

Can anyone recommend a good server-side PDF generation tool that would work in a Linux environment. I want easy as possible, pass it a XHTML file (with images) and have it generate a PDF from the rendered source.

I don't have a massive budget, but anything under $1000 should be alright.

Andrew

+1  A: 

I sounds like FPDF might be of help...

Also, the creation of PDF documents is called "PDF printing". I believe that might help you find other resources.

Thomas Owens
+3  A: 

FPDF is better suited to line by line creation - it makes taking an existing (X)HTML page and turning it into a PDF difficult. It can be done with HTMLDOC but I was looking for a more advanced solution.

Something like Prince XML would be ideal, but, it's a bit out of my price range at nearly $4000.

Thanks for responding so quickly :)

Andrew Taylor
+1 for princeXML with which I made great experiences!
tharkun
PrinceXML is vastly superior to all the other solutions available. It has excelent CSS support, and it's rendering is very close to what you would expect in comparison to the free alternatives. Depending on the nature of what you're building, maybe you could consider using it under the free license (http://www.princexml.com/license/). Despite of what the license seems to suggest, there's no watermark in generated PDFs (at least since version 7).
Andrei
A: 

I did some searching, what about tbookdtd? It's downloadable here but it hasn't been active since 2005. It appears to convert the xml to Latex, into PDF.

Craig
A: 

Have you investigated PHP's documentation? There's also PHP FAQ with a few different links. PHP primarily supports PDFlib.

Daniel Fone
A: 

@Daniel Fone

Again, PDFLib is more about generating PDF documents from scratch. There may be some solutions based on-top of PDFLib, but I haven't found, other than (PrinceXML), something that is really good at converting XHTML to PDF.

Thanks

Andrew

Andrew Taylor
A: 

I have recently came across dompdf which I have used to convert pages created in HTML into PDF documents. It uses PHP5 (assuming using PHP does not bother you). This is also assuming that you don't want to statically create HTML files on the file system and then convert them using some kind of command-line tool?

One problem I found with dompdf is that you don't get a whole lot of configuration options natively, but it is open-source and doesn't seem to be too large, so you could probably jury-rig something up pretty easily.

kaybenleroll
A: 

If you do have a budget take a look at the following OpenEdge. I know that they did excatly what you want for us. A linux based PDF generation system. I'd ask what they can do for you. Val Cassidy is the persons name.

BTW: I'm not getting anything for this and I don't even work for bespoke company anymore nor for OpenEdge ...

Johannes
+1  A: 

You might want to take a look at FOP, which stands for Formatting Objects Processor. It can generate PDF files on linux since it is Java based. From their site:

Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects (XSL-FO) and an output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output. Output formats currently supported include PDF, PS, PCL, AFP, XML (area tree representation), Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF.

You can find it here

A: 

You could take a look at using OpenOffice via the OpenOffice API to load your XHTML document and export a PDF version. There is a bit of a learning curve to using the OpenOffice API but it is very powerful and can be run in server mode on systems without any graphical interface. It performs well - we've used it on some internal projects.

stephen mulcahy
+1  A: 

I used HTMLDoc about 8 years ago and it did a good job of turning HTML tables with some basic formatting into a decent PDF report. There also seems to be an open source version as well.

Mark Nold