CodeIgniter – Plugin for DOMPDF
I have modified the plugin for DOMPDF which is found in CodeIgniter forum. I have added the paper size and orientation parameters. Here is the code to share with you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function pdf_create($html, $filename, $stream=true, $papersize = 'letter', $orientation = 'portrait') { require_once("dompdf/dompdf_config.inc.php"); $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->set_paper($papersize, $orientation); $dompdf->render(); if ($stream) { $options['Attachment'] = 1; $options['Accept-Ranges'] = 0; $options['compress'] = 1; $dompdf->stream($filename.".pdf", $options); } else { write_file("$filename.pdf", $dompdf->output()); } } ?> |