Skip to content

Commit

Permalink
Add Gotenberg option generateDocumentOutline to $options array (#92)
Browse files Browse the repository at this point in the history
* Add Gotenberg option generateDocumentOutline to $options array

* Add method_exists check before calling $option on the $chromium instance

* Move generateDocumentOutline to a separate block with a comment for minimum required versions to use the option

* Remove redundant != false check

* Add method_exists check for gotenberg-php < 2.10.0
  • Loading branch information
muratbinerbay authored Jan 30, 2025
1 parent 6a40624 commit b99526c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Processor/Gotenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public function getPdfFromString(string $html, array $params = [], bool $returnF
}
}

// generateDocumentOutline is only available for gotenberg >= 8.14.0 and gotenberg-php >= v2.10.0
if (isset($params['generateDocumentOutline']) && $params['generateDocumentOutline']
&& method_exists($chromium, 'generateDocumentOutline')) {
$chromium->generateDocumentOutline();
}

$chromium->margins(
$params['marginTop'] ?? 0.39,
$params['marginBottom'] ?? 0.39,
Expand Down

0 comments on commit b99526c

Please sign in to comment.