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; }