Pdf generating based on mysql data

Dear All,
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.

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?

Dear Immerse,
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?

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):


```php

<?php
require('fpdf.php');
 
// create a new PDF
$pdf = new FPDF();

// add an empty page
$pdf->AddPage(); 

// set the font to arial, 16pts and make it bold
$pdf->SetFont('Arial','B',16); 

// create a cell 40 points wide, 10 high, and write Hello World into it
$pdf->Cell(40,10,'Hello World!'); 

// output the pdf to the browser
$pdf->Output(); 
?>

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. :slight_smile:
Try it out, see how far you get and let us know if you get stuck :wink:

Dear Immerse,
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.