From a0fe240fc518941649cf921842f4aad3f0c7bd95 Mon Sep 17 00:00:00 2001 From: Christian Vette Date: Mon, 5 Mar 2018 12:48:56 +0100 Subject: [PATCH] [TASK] Adjust mPDF document options The document option names changed in mPDF 7 --- Classes/Generator/MpdfGenerator.php | 54 +++++++++++++++++------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/Classes/Generator/MpdfGenerator.php b/Classes/Generator/MpdfGenerator.php index 2ed4f3b..ecd7570 100644 --- a/Classes/Generator/MpdfGenerator.php +++ b/Classes/Generator/MpdfGenerator.php @@ -41,14 +41,14 @@ class MpdfGenerator implements PdfGeneratorInterface { 'encoding' => '', 'format' => 'A4', 'orientation' => 'P', - 'font-size' => 0, - 'font' => '', - 'margin-left' => 15, - 'margin-right' => 15, - 'margin-top' => 16, - 'margin-bottom' => 16, - 'margin-header' => 9, - 'margin-footer' => 9, + 'default_font_size' => 0, + 'default_font' => '', + 'margin_left' => 15, + 'margin_right' => 15, + 'margin_top' => 16, + 'margin_bottom' => 16, + 'margin_header' => 9, + 'margin_footer' => 9, ); public function setFormat($format) { @@ -65,13 +65,21 @@ public function setFooter($content) { public function setOption($name, $value) { $backwardsCompatabilityOptionNames = array( - 'marginLeft' => 'margin-left', - 'marginRight' => 'margin-right', - 'marginTop' => 'margin-top', - 'marginBottom' => 'margin-bottom', - 'marginHeader' => 'margin-header', - 'marginFooter' => 'margin-footer', - 'fontSize' => 'font-size' + 'marginLeft' => 'margin_left', + 'marginRight' => 'margin_right', + 'marginTop' => 'margin_top', + 'marginBottom' => 'margin_bottom', + 'marginHeader' => 'margin_header', + 'marginFooter' => 'margin_footer', + 'fontSize' => 'default_font_size', + 'margin-left' => 'margin_left', + 'margin-right' => 'margin_right', + 'margin-top' => 'margin_top', + 'margin-bottom' => 'margin_bottom', + 'margin-header' => 'margin_header', + 'margin-footer' => 'margin_footer', + 'font-size' => 'default_font_size', + 'font' => 'default_font' ); if (isset($backwardsCompatabilityOptionNames[$name])) { $name = $backwardsCompatabilityOptionNames[$name]; @@ -86,14 +94,14 @@ public function getMpdfInstance() { $mpdf = new \Mpdf\Mpdf( array('encoding' => $this->options['encoding'], 'format' => $this->options['format'], - 'font-size' => $this->options['font-size'], - 'font' => $this->options['font'], - 'margin-left' => $this->options['margin-left'], - 'margin-right' => $this->options['margin-right'], - 'margin-top' => $this->options['margin-top'], - 'margin-bottom' => $this->options['margin-bottom'], - 'margin-header' => $this->options['margin-header'], - 'margin-footer' => $this->options['margin-footer'], + 'default_font_size' => $this->options['default_font_size'], + 'default_font' => $this->options['default_font'], + 'margin_left' => $this->options['margin_left'], + 'margin_right' => $this->options['margin_right'], + 'margin_top' => $this->options['margin_top'], + 'margin_bottom' => $this->options['margin_bottom'], + 'margin_header' => $this->options['margin_header'], + 'margin_footer' => $this->options['margin_footer'], 'orientation' => $this->options['orientation']) );