Rectangle 27 0

print to pdf with php?


As Helle said, FPDF is a really neat tool for generating PDFs from PHP. Although using FPDF you'll have to dig into its manual, as it doesn't convert HTML into PDFs. From my experience though, FPDF is rather straightforward to use and you should not have too much trouble with it.

i tried this for several time, but i not get any luck yet, it seem hard code to me.

Note
Rectangle 27 0

print to pdf with php?


"there is no library which can handle html code that well" - so leave it to a tried and tested rendering engine like I suggest.

Hi, i am not familiar with anything of pdf library, but use fpdf seem hard code to me, because everything need to create first, dompdf seem easy than fpdf but lot of security risk, and now i want to see another alternative e.g. tcpdf, html2pdf (html2pdf.fr/en/default) or wkhtmltopdf does someone have experience with? thanks for you suggestions

The big problem is, that there is no library which can handle html code that well.

dom-pdf is a very good one, but have still huge problems with nested tables an page breaks. for your reason it should do the trick, I guess. It can also handle css a bit.

dompdf is fairly straight-forward to use. There is one security issue, but it is dependent on your configuration and fairly easy to work around (as helle mentioned). Plus, it would be easy to convert your invoice by just passing in the URL for the invoice.

for dom-pdf you have a link from kinjal above. and fpdf you have already found.

if it is a matter of time, i gues you'll need same time for setting up one of the later suggestions, and finding into the fpdf-class. hint for that: concentrate on multi-cell rather than cell.

if you can create the table yourself, I strongly recommend using fpdf. you will not be able to handle any css, but there are many formatting possibilities with fpdf.

to the security issue: To resolve the security issue of DOMPDF, all that is needed is to modify DOMPDF slightly to only function in cgi mode, preventing any access from external sources and only able to be called from your application.

Note
Rectangle 27 0

print to pdf with php?


@user What file format is the invoice in? We are all assuming HTML, but perhaps it isn't.

the file format of my invoice is .tpl use as template site, inside the .tpl file have a lot php code as shown above.

wkhtml uses the WebKit rendering engine and as such produces fantastic results. See my answer on Converting html to pdf in php ? for further details.

yes it seem great, but i still searching the sample regarding of my invoice code above, could you have idea? thanks

Note
Rectangle 27 0

print to pdf with php?


"there is no library which can handle html code that well" - so leave it to a tried and tested rendering engine like I suggest.

Hi, i am not familiar with anything of pdf library, but use fpdf seem hard code to me, because everything need to create first, dompdf seem easy than fpdf but lot of security risk, and now i want to see another alternative e.g. tcpdf, html2pdf (html2pdf.fr/en/default) or wkhtmltopdf does someone have experience with? thanks for you suggestions

The big problem is, that there is no library which can handle html code that well.

dom-pdf is a very good one, but have still huge problems with nested tables an page breaks. for your reason it should do the trick, I guess. It can also handle css a bit.

dompdf is fairly straight-forward to use. There is one security issue, but it is dependent on your configuration and fairly easy to work around (as helle mentioned). Plus, it would be easy to convert your invoice by just passing in the URL for the invoice.

for dom-pdf you have a link from kinjal above. and fpdf you have already found.

if it is a matter of time, i gues you'll need same time for setting up one of the later suggestions, and finding into the fpdf-class. hint for that: concentrate on multi-cell rather than cell.

if you can create the table yourself, I strongly recommend using fpdf. you will not be able to handle any css, but there are many formatting possibilities with fpdf.

to the security issue: To resolve the security issue of DOMPDF, all that is needed is to modify DOMPDF slightly to only function in cgi mode, preventing any access from external sources and only able to be called from your application.

Note
Rectangle 27 0

print to pdf with php?


@user What file format is the invoice in? We are all assuming HTML, but perhaps it isn't.

the file format of my invoice is .tpl use as template site, inside the .tpl file have a lot php code as shown above.

wkhtml uses the WebKit rendering engine and as such produces fantastic results. See my answer on Converting html to pdf in php? for further details.

yes it seem great, but i still searching the sample regarding of my invoice code above, could you have idea? thanks

Note
Rectangle 27 0

print to pdf with php?


As Helle said, FPDF is a really neat tool for generating PDFs from PHP. Although using FPDF you'll have to dig into its manual, as it doesn't convert HTML into PDFs. From my experience though, FPDF is rather straightforward to use and you should not have too much trouble with it.

i tried this for several time, but i not get any luck yet, it seem hard code to me.

Note