Skip to content

Commit

Permalink
Pass metadata to gotenberg-chromium on version > 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
muratbinerbay committed May 28, 2024
1 parent 30a08c3 commit 1c635cd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Processor/Gotenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,9 @@ public function getPdfFromString(string $html, array $params = [], bool $returnF
$chromium->extraHttpHeaders($params['extraHttpHeaders']);
}

if (isset($params['metadata'])) {
if (method_exists($chromium, 'metadata')) {
$chromium->metadata($params['metadata']);
} elseif (is_callable([$chromium, 'formValue'])) {
$chromium->formValue('metadata', json_encode($params['metadata']));
}
// 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));
Expand Down

0 comments on commit 1c635cd

Please sign in to comment.