From 204882119051827b8b635535eeb529f1c2f8c582 Mon Sep 17 00:00:00 2001 From: Dasc3er Date: Thu, 10 Sep 2020 17:16:29 +0200 Subject: [PATCH] Fix per gestione dinamica margini stampe --- src/Prints.php | 13 ++++++++++--- templates/base/settings.php | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Prints.php b/src/Prints.php index da4203923..758027f0c 100755 --- a/src/Prints.php +++ b/src/Prints.php @@ -17,6 +17,8 @@ * along with this program. If not, see . */ +use Mpdf\Mpdf; + /** * Classe per la gestione delle informazioni relative alle stampe installate. * @@ -459,14 +461,19 @@ class Prints include DOCROOT.'/templates/info.php'; // Instanziamento dell'oggetto mPDF - $mpdf = new \Mpdf\Mpdf([ + $mpdf = new Mpdf([ 'format' => $settings['format'], 'orientation' => strtoupper($settings['orientation']) == 'L' ? 'L' : 'P', 'font-size' => $settings['font-size'], 'margin_left' => $settings['margins']['left'], 'margin_right' => $settings['margins']['right'], - 'setAutoBottomMargin' => 'stretch', - 'setAutoTopMargin' => 'stretch', + + 'setAutoTopMargin' => $settings['margins']['top'] === 'auto' ? 'stretch' : false, + 'margin_top' => $settings['margins']['top'] === 'auto' ? 0 : $settings['margins']['top'], // Disabilitato se setAutoTopMargin impostato + + 'setAutoBottomMargin' => $settings['margins']['bottom'] === 'auto' ? 'stretch' : false, + 'margin_bottom' => $settings['margins']['bottom'] === 'auto' ? 0 : $settings['margins']['bottom'], // Disabilitato se setAutoBottomMargin impostato + 'default_font' => 'dejavusanscondensed', // Abilitazione per lo standard PDF/A diff --git a/templates/base/settings.php b/templates/base/settings.php index a820e21fc..6044e5f88 100755 --- a/templates/base/settings.php +++ b/templates/base/settings.php @@ -22,8 +22,8 @@ $settings = [ 'format' => 'A4', 'font-size' => 10, 'margins' => [ - 'top' => 10, - 'bottom' => 10, + 'top' => 'auto', + 'bottom' => 'auto', 'left' => 12, 'right' => 12, ],