Files
opensourcepos/app/Helpers/dompdf_helper.php
BudsieBuds e83c23cf0c Improve code style and PSR-12 compliance (#4204)
* Improve code style and PSR-12 compliance
- refactored code formatting to adhere to PSR-12 guidelines
- standardized coding conventions across the codebase
- added missing framework files and reverted markup changes
- reformatted arrays for enhanced readability
- updated language files for consistent styling and clarity
- minor miscellaneous improvements
2025-05-02 19:37:06 +02:00

21 lines
495 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 '';
}