From 4242f98213392519769f25063be4c84904661f4a Mon Sep 17 00:00:00 2001 From: Thomas Zilio Date: Tue, 12 Sep 2017 17:04:38 +0200 Subject: [PATCH] Miglioramento della gestione delle stampe Aggiunto supporto alla modifica della dimensione del testo all'interno delle stampe. --- pdfgen.php | 10 ++++++++++ templates/base/settings.php | 2 +- templates/base/style.css | 4 ++-- templates/ddt/settings.php | 4 ++-- templates/fatture/settings.php | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pdfgen.php b/pdfgen.php index 9acba9c2c..2148b43ea 100644 --- a/pdfgen.php +++ b/pdfgen.php @@ -147,6 +147,7 @@ if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { 'templates/base/style.css', ]; + // Instanziamento dell'oggetto mPDF $mpdf = new mPDF( 'c', $settings['dimension'], @@ -161,16 +162,25 @@ if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { strtolower($settings['orientation']) == 'l' ? 'l' : 'p' ); + // Impostazione di header e footer $mpdf->SetHTMLFooter($foot); $mpdf->SetHTMLHeader($head); + // Impostazione del titolo del PDF $mpdf->SetTitle($title); + // Inclusione dei fogli di stile CSS foreach ($styles as $value) { $mpdf->WriteHTML(file_get_contents(__DIR__.'/'.$value), 1); } + + // Impostazione del font-size + $mpdf->WriteHTML('body {font-size: '.$settings['font-size'].'pt;}', 1); + + // Aggiunta dei contenuti $mpdf->WriteHTML($report); + // Creazione effettiva del PDF $mpdf->Output($filename, $mode); } else { if (!str_contains($report, '')) { diff --git a/templates/base/settings.php b/templates/base/settings.php index d74632b40..721e335c0 100644 --- a/templates/base/settings.php +++ b/templates/base/settings.php @@ -3,7 +3,7 @@ return [ 'orientation' => 'p', 'dimension' => 'A4', - 'font-size' => '11pt', + 'font-size' => 10, 'margins' => [ 'top' => 10, 'bottom' => 10, diff --git a/templates/base/style.css b/templates/base/style.css index 19d295dbe..b9cea9058 100644 --- a/templates/base/style.css +++ b/templates/base/style.css @@ -58,12 +58,12 @@ table.vertical-middle th { vertical-align: middle; } -table#contents td { +table#contents tbody td { border-top: 0; border-bottom: 0; } -table #contents thead th { +table#contents thead th { font-size: 80%; } diff --git a/templates/ddt/settings.php b/templates/ddt/settings.php index 701304036..2ffe0e8fd 100644 --- a/templates/ddt/settings.php +++ b/templates/ddt/settings.php @@ -1,6 +1,6 @@ '80', - 'footer-height' => '80', + 'header-height' => 80, + 'footer-height' => 80, ]; diff --git a/templates/fatture/settings.php b/templates/fatture/settings.php index 77c015061..62dfa7023 100644 --- a/templates/fatture/settings.php +++ b/templates/fatture/settings.php @@ -1,6 +1,6 @@ '80', - 'footer-height' => '60', + 'header-height' => 80, + 'footer-height' => 60, ];