From d571484195933a3b73cbb538a1e0f6b730059361 Mon Sep 17 00:00:00 2001 From: "Tarvo R." Date: Wed, 23 Oct 2024 20:11:18 +0300 Subject: [PATCH] Add PDF fullPage support --- src/Browsershot.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Browsershot.php b/src/Browsershot.php index d50ee04..9a7131d 100644 --- a/src/Browsershot.php +++ b/src/Browsershot.php @@ -878,6 +878,13 @@ public function createPdfCommand($targetPath = null): array $command['options']['scale'] = $this->scale; } + if ($this->additionalOptions['fullPage'] ?? false) { + $heightPx = $this->callBrowser($this->createCommand($url, 'evaluate', ['pageFunction' => 'document.body.scrollHeight'])); + $widthPx = $this->callBrowser($this->createCommand($url, 'evaluate', ['pageFunction' => 'document.body.scrollWidth'])); + $command['options']['height'] = $heightPx; + $command['options']['width'] = $widthPx; + } + return $command; }