How to export data to pdf?

Can I convert PHP output to PDF and e-mail it?

  • My website has a long form that I'd like to export to PDF and then e-mail to myself. Currently, my form collects data and submits it to a PHP file, which e-mails me the results. Instead of getting an HTML e-mail which has printing limitations (inconsistent CSS, background colors don't print automatically, etc.) I'd like to get a consistent and attractive PDF attached to an e-mail. It would be nice if I could include some graphics, but I'm more concerned with readability (specifically, alternating colors in the rows.) Is there an easy way to do this automatically and for free?

  • Answer:

    Php has functions, libraries and classes to convert anything into a PDF document. It is NOT very easy to use, but once you get the hang of it, it is brilliant. The initial class if FPDF. If you can't find it, email me your address, I'll zip it for you with an example.

Alex K at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

If you google php pdf you'll get a number of hits suggesting how you can create PDFs in PHP. The PDF library recommended by the book I read three years ago is FPDF, but there may be better options now.

zelmo_t

Yes you can, but I think you're solving the wrong problem. Instead of PDF, I think you should either 1) convert the form data to a CSV file format (comma separated value) and open it in Excel[1], or 2) make correct print CSS (the best practices for making print CSS differs from regular CSS, e.g. in print CSS using pt measurement is preferred instead of px) [1] then possibly use a script or Excel macro to convert the CSV to a more attractive format. HTML and PDF are useless for data processing, it is only useful for preparing document for printing.

Lie Ryan

You can make anything into a PDF for free using Foxit Reader. Just install the program and then you can turn anything into a PDF by hitting print and selecting "Foxit PDF Printer" from the list of printers. (It will have a small watermark in the heading if you just use the trial version.)

Amyra

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.