...

View Full Version : Converting mysql query to pdf?



jedimastermopar
11-24-2006, 05: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?

firepages
11-25-2006, 05: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!)

GJay
11-25-2006, 06:33 PM
http://sourceforge.net/projects/pdf-php

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)

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum