View Full Version : Converting mysql query to pdf?

11-24-2006, 06:09 PM
I have writen a pretty basic php page to do a lookup on a remote database. It retrieves about 8000 records. This is fine. But its pretty doggy once it gets to the browser. Does anyone know of a way I can make a batch program to run on my linux server so I can every night run the php command and generate a pdf file from the output of the php code?

11-25-2006, 06:59 PM
you can either use a PHP class ..excellent free one here >> http://www.ros.co.nz/pdf/

or if your server (is *nix &&) has html2ps & ps2pdf installed you can write a script to be run from cron

html2ps `php -f file.php` out.ps && ps2pdf out.ps out.pdf'

(not a clue if you can call php -f file.php like that but worth a go (file.php returns valid your html document!)

11-25-2006, 07:33 PM

is pretty straightforward to use. fpdf is another that's a bit simpler, but also more basic.

(the -f as an option to `php` is optional if there are no other parameters, the fact it's a filename is assumed)

11-27-2006, 03:49 PM
Thanks, guys, I'll check em out and post back the results.

11-27-2006, 03:51 PM
Oh yah, I should have mentioned, running, ubuntu, so it will be a cron job.