Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PDF Creation via PHP

  • 15-11-2006 12:44PM
    #1
    Closed Accounts Posts: 8,478 ✭✭✭


    We've been using standard HTML/PHP to display printable reports depending on data coming back from MySQL. Trying to control the HTML formatting when printed on different printers is becoming a pain. What I want to do is try to create PDF documents on the fly.

    I've tried to use some of the more popular methods - such as html2fpdf and so on. None worked as well as I would like, as they all seem to fail when attempting to generate the PDF versions of the HTML tables.

    I use the free software from primopdf.com to create "proper" pdf documents, but this is obviously something that I would rather automate, and not have to depend on a 3rd party executable.

    Ideas!


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    You can add an extension to PHP to allow you to create PDF documents directly from the scripts. I have searched briefly in the past, but it doesn't seem to be possible to get a free extension...

    PDFLib gives the highest google ranking:
    http://www.pdflib.com/download/pdflib-family/pdflib-7/

    If all the machines are of a standard build, perhaps you could try exporting in RTF or CSV or something which would print a little more standard than HTML?


  • Registered Users, Registered Users 2 Posts: 5,618 ✭✭✭Civilian_Target


    You could get your program to output a Latex-formatted file and then use PDFLatex to compile it...

    A better suggestion, however, would be to simply define a printing style-sheet: xhtml/CSS2 supports a header tag (can't remember it off hand) that is automatically invoked when the browser tries to print: maybe that's what you're looking for!s


Advertisement