gest366/templates/pdfgen.php

49 lines
1.3 KiB
PHP

<?php
include_once(__DIR__."/../core.php");
include_once($docroot . "/lib/user_check.php");
$n_pages = 1;
$orientation = 'P';
$body_table_params = "style='width:210mm;'";
$font_size = "10pt";
//Tipo di stampa
$ptype = $html->form('ptype');
//Decido se usare la stampa personalizzata (se esiste) oppure quella standard
if (@file_exists($ptype . "/custom/pdfgen." . $ptype . ".php")) {
include($docroot . "/templates/" . $ptype . "/custom/pdfgen." . $ptype . ".php");
}
else {
include($docroot . "/templates/" . $ptype . "/pdfgen." . $ptype . ".php");
}
/*
Completamento e output del report
*/
$report = str_replace('$body$', $body, $report);
$report = str_replace('$footer$', $footer, $report);
$report = str_replace('$footer1$', $footer, $report);
$report = str_replace('$body_table_params$', $body_table_params, $report);
$report = str_replace('$font_size$', $font_size, $report);
$report = str_replace('$docroot$', $docroot, $report);
//html
$formato = get_var('Formato report');
$html = ($formato == 'html') ? true : false;
try {
ob_end_clean();
$html2pdf = new HTML2PDF($orientation, 'A4', 'it', true, 'UTF-8');
$html2pdf->writeHTML($report, $html);
$html2pdf->Output(sanitizeFilename($report_name));
}
catch (HTML2PDF_exception $e) {
echo $e;
exit;
}
?>