views:

902

answers:

7

In my site i m fetching my mysql data by using PHP. I want open that data in pdf file when i click pdf print button is it possible?

+2  A: 

First of all, if you want a high quality professional product to do that. You want Prince XML

If you are looking into some open source tool to achieve something similar. You can look into this SO question.

Ólafur Waage
A: 

You could prepare static PDF form file, that just fill it in with values using PHP's FDF module.

vartec
A: 

It depends which platform are you using. This would be an easy job if you are using Groovy on grails. There are plugins which facilitate pdf reporting like the jasper-plugin.

Luis

Luixv
A: 

Check out jsPDF, an open-source library for generating PDF documents using nothing but JavaScript.

A: 

You can process the data with Apache FOP after transforming it to XML. (http://xmlgraphics.apache.org/fop/).

If your page is template based, you may create a template which produces xml output and process that. You'll have extremely well contol over the pdf construction. The tradeoff is that it is not a "plug this in and will work" solution, but I've done that and once its set up, works like charm.

Csaba Kétszeri
A: 

I've used TCPDF in the past, it's a little kludgy but can definitely get the job done. (http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf)

rnavarro
A: 

The FPDF module in PHP is simple enough to get the data together. It is a safe option since you know what data you are passing out to the PDF engine. There are some streaming pdf options which can take in a bunch of html and then output that to pdf however they can get it quite wrong without you knowing.

Ryaner