mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-24 17:27:55 -05:00
27 lines
606 B
PHP
27 lines
606 B
PHP
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
function pdf_create($html, $filename = '', $stream = TRUE)
|
|
{
|
|
// need to enable magic quotes for the
|
|
$magic_quotes_enabled = get_magic_quotes_runtime();
|
|
if(!$magic_quotes_enabled)
|
|
{
|
|
ini_set("magic_quotes_runtime", true);
|
|
}
|
|
|
|
$dompdf = new Dompdf\Dompdf();
|
|
$dompdf->loadHtml($html);
|
|
$dompdf->render();
|
|
|
|
ini_set("magic_quotes_runtime", $magic_quotes_enabled);
|
|
|
|
if ($stream)
|
|
{
|
|
$dompdf->stream($filename.".pdf");
|
|
}
|
|
else
|
|
{
|
|
return $dompdf->output();
|
|
}
|
|
}
|
|
?>
|