Create .pdf with PHP from MySQL table

I apologize if this is not the correct forum to post this request, but I’m wondering how PHP could take a MySQL dbase table and automatically create it in .pdf. There would be a link on a web page for a user to download the created .pdf any time.

How complicated is this task?


Its not too difficult.

There are functions in php to create pdf.

You can start reading here

As far as getting the MySQL data.
I guess you’d have to read all tables, and all records from each table, and write to pdf.

If you don’t know how to do that, you can start reading here

Hope this helps :slight_smile:

Thanks! I’ll look into that!

There are many classes that allow you to generate PDF files from within PHP.

A good place to start from would be to perform a Google search on “FPDF”.


OK! Great! Thank you!

ezpdf has a nice method for creating tables on the fly.

I’d take a look at how the guys who make PhpMyAdmin (PMA) do it, you have an option to print a result-set. You’ve probably got PMA installed on your computer in any case.