Skip to content

Commit

Permalink
Merge pull request #18 from cvette/task/cv-update-options
Browse files Browse the repository at this point in the history
[TASK] Adjust mPDF document options
  • Loading branch information
Marc Neuhaus authored Mar 6, 2018
2 parents e4dd733 + a0fe240 commit 45efd89
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions Classes/Generator/MpdfGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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];
Expand All @@ -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'])
);

Expand Down

0 comments on commit 45efd89

Please sign in to comment.