Hi frns

Am asha ! just looking and searching for a while how to convert php output as pdf file. I mean the localhost output of php file will be save as pdf file. If anybody knows pl help me.

Thanks in advance

asha

Recommended Answers

All 8 Replies

I use TCPDF library (http://www.tcpdf.org/). It is being actively developed, has examples, it works and it is free.

is there any specific function in fpdf or tcpdf to retrieve database tables because both fpdf and tcpdf have only text formatting functions and there is no database connectivity or retrieving dynamically

You need to write your own code for retriveing from mysql. LIke you do to format data to html. Same way you fetch data and use tcpdf funtions to format your pdf file.

tcpdf is advance and If you look at tcpdf examples, you will find almost all kind of examples. I am sure your case will fit into one of them.

I find this to be the easiest approach. You need to format your output (in html) the way you want to see it saved to PDF. You write that output to a variable and then echo it initially to see that the format is correct. Then you can send that variable to html2pdf to convert it. This doesn't require a lot of special code in your program. The conversion process works pretty well. The most important rule is that your html must have a closing tag for all of your html (opening) tags. You can get away with taking shortcuts in html but this program expects everything to be matched properly

Click Here

Member Avatar for diafol

I haven't used html2pdf, but I can wholly recommend tcpdf. I have used quite a few php-based converters, but this is my favourite one so far. May have a look at html2pdf - thanks Chris.

If you have server access or a hosting company that will install libraries for your use then a great PHP option is to use Snappy it wraps the wkhtmltopdf library and the wkhtmltoimage library.

commented: good link +14

Rar! Ïs 7 t 0 O d ­•njNeœC 3
you cam.txt ğ>_ PÔËäϱC |$ş8"á È QH¥_Ÿ˜sI¶šmä½WQÔr÷°ÿ|Ä£‘sSR lÛÃW¤´V|

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.