diff --git a/composer.json b/composer.json index 9666e65..e2ab1be 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require-dev": { "phpstan/phpstan": "^1.10.5", "phpstan/phpstan-symfony": "^1.2.20", - "gotenberg/gotenberg-php": "^1.0 || ^2.0", + "gotenberg/gotenberg-php": "^1.1.8 || ^2.2", "chrome-php/chrome": "^1.8", "codeception/codeception": "^5.0.3", "codeception/module-symfony": "^3.1.0", diff --git a/src/Processor/Gotenberg.php b/src/Processor/Gotenberg.php index 61c121a..f55e9c4 100644 --- a/src/Processor/Gotenberg.php +++ b/src/Processor/Gotenberg.php @@ -166,6 +166,11 @@ public function getPdfFromString(string $html, array $params = [], bool $returnF $chromium->extraHttpHeaders($params['extraHttpHeaders']); } + // metadata is only passed on gotenberg-php > 2.2 + if (isset($params['metadata']) && method_exists($chromium, 'metadata')) { + $chromium->metadata($params['metadata']); + } + $request = $chromium->outputFilename($tempFileName)->html(Stream::string('processor.html', $html)); if ($returnFilePath) {