Skip to content

Commit

Permalink
Fix "margin" option for PDF creation (#104)
Browse files Browse the repository at this point in the history
* fix "margin" option

The browser.js option is actually called "margin" not "margins".

* Fix tests with renamed "margin" option
  • Loading branch information
martinfobian authored and freekmurze committed Oct 25, 2017
1 parent 9029014 commit b62f951
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Browsershot.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function createPdfCommand($targetPath): array
}

if ($this->margins) {
$command['options']['margins'] = [
$command['options']['margin'] = [
'top' => $this->margins['top'].'mm',
'right' => $this->margins['right'].'mm',
'bottom' => $this->margins['bottom'].'mm',
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowsershotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function it_can_create_a_command_to_generate_a_pdf()
'path' => 'screenshot.pdf',
'printBackground' => true,
'landscape' => true,
'margins' => ['top' => '10mm', 'right' => '20mm', 'bottom' => '30mm', 'left' => '40mm'],
'margin' => ['top' => '10mm', 'right' => '20mm', 'bottom' => '30mm', 'left' => '40mm'],
'pageRanges' => '1-3',
'width' => '210mm',
'height' => '148mm',
Expand Down Expand Up @@ -211,7 +211,7 @@ public function it_can_create_a_command_to_generate_a_pdf_with_paper_format()
'path' => 'screenshot.pdf',
'printBackground' => true,
'landscape' => true,
'margins' => ['top' => '10mm', 'right' => '20mm', 'bottom' => '30mm', 'left' => '40mm'],
'margin' => ['top' => '10mm', 'right' => '20mm', 'bottom' => '30mm', 'left' => '40mm'],
'pageRanges' => '1-3',
'format' => 'a4',
'viewport' => [
Expand Down

0 comments on commit b62f951

Please sign in to comment.