PHP5 PDF Generation?

Lately I've been thinking about building and implementing my own invoicing system with PHP and I want to have an optional Download / Generate PDF button that creates a PDF based either on a template that was generated or based on html / css.

I want the method to be free (as some are ridiculously overpriced) and hopefully not too hard to use. The end goal is to create something that would be good enough for commercial use (though not my intention to sell it).

I've heard of options like TCPDF, Dompdf, wkhtmlpdf, etc. But again, I'm looking for the one that will make the most correct and potentially commercial use. I would like the suggestions to be based solely on what I need as I searched the site for similar topics; I know of different libraries, but not sure what I should be using.

Thanks in advance!:)

+3


source to share


4 answers


After doing this a few times, my suggestion was to take an existing library that wraps the low level PDF tools in a decent API and then build a custom library specific to your needs (billing) on ​​top of it.



I suggest Zend PDF or TCPDF as a base build library. When you add classes to your own library, you will be able to complete things like table / row generation, headers and footers, etc.

+4


source


I used FPDF library, I liked it. http://www.fpdf.org/



and check this manual anyway: http://php.net/manual/en/book.pdf.php

+2


source


I am often suspicious of low-level reporting systems (TCPDF et al.) - they are very well done, but if a business needs a new report, it may take an age to write code to bring the report to the client's requirements, so I prefer the GUI / server-side solutions. such as iReport (used to generate a report) and Jasper (a report server) - the editableness of such a report is almost instantaneous and therefore much more sensitive to changing business requirements.

On the plus side, it's free and open source, but on the downside, you need a spare server to run it. It is Java based, but reports can be run through PHP using SOAP.

+1


source


If you can use external tools, I recommend wkhtmlpdf. It's very easy to use. Check out "PHP Integration" on your wiki: https://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp

0


source







All Articles