mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-19 06:47:56 -05:00
- Replaced TRUE/FALSE constants with true/false keywords - Replaced NULL constant with null keyword - Replaced `<?php echo` in views with shortened `<?=` - Added missing variable declaration - Added missing function return type in declaration - replaced `== true`, `== false`, `=== true` and `=== false` in if statements with simplified forms
24 lines
503 B
PHP
24 lines
503 B
PHP
<?php
|
|
|
|
/**
|
|
* PDF helper
|
|
*/
|
|
function create_pdf(string $html, string $filename = ''): string
|
|
{
|
|
// need to enable magic quotes for the
|
|
$dompdf = new Dompdf\Dompdf (['isRemoteEnabled' => true, 'isPhpEnabled' => true]);
|
|
$dompdf->loadHtml(str_replace (['\n', '\r'], '', $html));
|
|
$dompdf->render();
|
|
|
|
if($filename != '')
|
|
{
|
|
$dompdf->stream($filename . '.pdf');
|
|
}
|
|
else//TODO: Not all paths return a value.
|
|
{
|
|
return $dompdf->output();
|
|
}
|
|
|
|
return '';
|
|
}
|