
Originally Posted by
papadammy
Thanks a lot everyone who have taken their time to respond to my question. I think pdf is the way to go and I've studied fpdf within the last 2 days to see how easy it'll be to implement. Though the tables making up the document is quite complex but I should be able to get it done. My other worry is how to fill in the spaces in the document with result from the database. I hope fpdf supports that. Thanks a lot
This is what I usually do with fpdf
- Download fpdi
- Take the existing word document or template and turn it into a PDF (especially if it only contains the static content)
- Using fpdf with fpdi, load the template and then write whatever text you need on top of the template to produce the final PDF
Sample code:
PHP Code:
require_once('pdf-templates/fpdf.php');
require_once('pdf-templates/fpdi.php');
$pdf = new FPDI('P', 'pt', 'Letter');
$pdf->AddPage('P', 'Letter');
$pdf->setSourceFile('template.pdf');
$templatePage = $pdf->importPage(1);
$pdf->useTemplate($templatePage, 0, 0, 0, 0, true);
$pdf->Image($itemData->qrcodeAbsolutePath, 490, 640, 0, 0, "png");
$pdf->SetFont('Arial', 'B', 28);
$pdf->SetTextColor(159, 31, 32);
$pdf->SetXY(28, 180);
$pdf->MultiCell(0, 28, $boatDescription, 0, 'C', false);
Hopefully this should get you started. I've had great success with this route.
Bookmarks