Generating PDF with fuelPHP is very straight forward using the built in wrappers around TCPDF or DOMPDF (my preferred choice)
First things, configure fuel to use pdf
To generate a PDF with fuelPHP:
[code]
$data[‘quote’] = Model_Quote::find($id);
$view = View::forge(‘quotes/print’, $data, false);
$pdf = Pdf::factory(‘dompdf’)->init();
$pdf->set_paper(‘A4’);
$pdf->load_html($view);
$pdf->render();
[/code]
In View file, in views/quotes/print is just plain old HTML and CSS. DOMPDF does a great job of outputting very well formatted PDFs from proper markup.
1 Comment
I search so many website but still can’t have the working example for configuring and generating PDF using FuelPHP. I use TJS-Technology from forum, but there’s still an error in it. using tcpdf, I can’t generate PDF. Using dompdf and load html, I can’t have the correct generated PDF. Can you give detail example to configure and generate PDF using FuelPHP please…, Thanks before.