Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Converting mysql query to pdf?

    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?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    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!)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    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)

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, guys, I'll check em out and post back the results.

  • #5
    Regular Coder
    Join Date
    Nov 2006
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh yah, I should have mentioned, running, ubuntu, so it will be a cron job.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •