Download the table content to pdf -PHP

Hi all, After some weeks I came with one important topic, it is very useful to developers. Because nowadays, fetch the table content or html content to pdf and then download the pdf file; its very common in real world.

This topic is already discuss; here I use different method than other. Because HTML or PHP to pdf is not an easy task. So, I try solve this problem very easy method.

There are two important js files are included for solving data to pdf file in php. First we include jquery (normal jquery like jquery10.1, jquery 11) file and second is; another js file related to pdf.

In here we can download specified div. We can download between the div content as you wish. And we can specify the pdf table or content style through script.

Sample Code

Report

Name Sex Hours
Pritty F 20:10:46
Princy F 21:10:46
Prince M 20:10:46

In the above code; we include two js files and we click the button then the html data convert to pdf file and automatically download or save as employee_report.pdf file. I think its very easy to understand.

If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *