Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jan 14, 2024
1 parent 0357549 commit 5922155
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/PdfBuilder.php
Expand Up @@ -36,6 +36,8 @@ class PdfBuilder implements Responsable

public ?string $format = null;

public ?array $paperSize = null;

public ?string $orientation = null;

public ?array $margins = null;
Expand Down Expand Up @@ -209,9 +211,11 @@ public function paperSize(float $width, float $height, Unit|string $unit = 'mm')
$unit = $unit->value;
}

$this->withBrowsershot(function (Browsershot $browsershot) use ($width, $height, $unit) {
$browsershot->paperSize($width, $height, $unit);
});
$this->paperSize = compact(
'width',
'height',
'unit',
);

return $this;
}
Expand Down Expand Up @@ -340,6 +344,10 @@ protected function getBrowsershot(): Browsershot
$browsershot->format($this->format);
}

if ($this->paperSize) {
$browsershot->paperSize(...$this->paperSize);
}

if ($this->orientation === Orientation::Landscape->value) {
$browsershot->landscape();
}
Expand Down

0 comments on commit 5922155

Please sign in to comment.