newtomysql — 2011-09-30T00:03:45-04:00 — #1
I would like to generate pdf document via my php page which are based on mysql data? Any recommendation so far I have seen fpdf and tcpdf. Which one will be better or is there any better tool for it? Thank you.
immerse — 2011-09-30T02:14:12-04:00 — #2
Nope, those two are probably the best tools.
I've not worked with tcpdf, but I've used fpdf extensively. It's quite verbose, but is generates decent PDFs.
What kind of data will you be displaying?
newtomysql — 2011-09-30T02:40:16-04:00 — #3
Mine lots of gps data. What I want is for instance a user select a vehicle, start date and end date. Then first I will show the report on the page itself. Upon that will have a save button where user click and I want it to be in the format of pdf. What is the best mechanism to go about since you have lots of experience in it?
immerse — 2011-09-30T09:10:31-04:00 — #4
Do you already have a design/ setup in mind for what the PDF should look like?
Depending on how complicated it is, it'll be quite easy to make, or very difficult.
Here's a quick example of making a PDF (copied from the [url=http://www.fpdf.org/]FPDF site
, I added some comments to show what's going on):
// create a new PDF
$pdf = new FPDF();
// add an empty page
// set the font to arial, 16pts and make it bold
// create a cell 40 points wide, 10 high, and write Hello World into it
// output the pdf to the browser
The manual on that site is pretty decent, it explains most of the possibilities quite well.
Just a quick warning, it might take a while to get used to creating PDFs like this.
Try it out, see how far you get and let us know if you get stuck
newtomysql — 2011-09-30T12:29:29-04:00 — #5
I have an idea where I will have a header and footer and in between will be the data which is based on mysql db ? So any good sample on mysql because I only saw one sample their pages.