Fix external files inclusion in PDF

This commit is contained in:
From Obelix 2024-01-27 01:18:25 +01:00
parent ea0e0a10b3
commit 7631ace2d5
2 changed files with 9 additions and 8 deletions

1
.gitignore vendored
View File

@ -9,4 +9,5 @@
/.cache
/.config
/.local
/.lesshst
_DOCS

View File

@ -370,20 +370,21 @@ function eraseLegumeTarif($id) {
////////////////////////////////////////////////////////////////////////
function printLegumesList() {
$GLOBALS['smarty'] -> assign('logo', PUBLIC_HTML_ADMIN.'img/logo.png');
$root_url = "file://".ROOT_DIR_PATH."public_html_admin";
$GLOBALS['smarty'] -> assign('logo', "$root_url/img/logo.png");
$GLOBALS['smarty'] -> assign('date', formatDate('', '', 'print_date'));
$GLOBALS['smarty'] -> assign('time', formatDate('', '', 'print_time'));
$cssFiles = array(
PUBLIC_HTML_ADMIN.'css/bootstrap_print_light.css',
PUBLIC_HTML_ADMIN.'css/print.css'
"$root_url/css/bootstrap_print_light.css",
"$root_url/css/print.css",
);
$GLOBALS['smarty'] -> assign('cssFiles',$cssFiles);
$html = $GLOBALS['smarty']->fetch("legumes/legumes_list_print.tpl");
//die($html);
$dompdf = new Dompdf\Dompdf();
$dompdf = new Dompdf\Dompdf(["chroot" => ROOT_DIR_PATH]);
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', "portrait");
$options = $dompdf->getOptions();
@ -392,6 +393,5 @@ function printLegumesList() {
$dompdf->render();
$dompdf->stream("Liste des légumes (".formatDate('', '', 'strdate').").pdf");
die();
exit();
}