Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PDF Creation via PHP

Options
  • 15-11-2006 1: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 Posts: 68,317 ✭✭✭✭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 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