Skip to content

Commit

Permalink
Just use formValue to support both v1 and v2
Browse files Browse the repository at this point in the history
Co-authored-by: JiaJia Ji <kingjia90@gmail.com>
  • Loading branch information
muratbinerbay and kingjia90 committed Apr 2, 2024
1 parent 5e44e85 commit 437b18f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Processor/Gotenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ public function getPdfFromString(string $html, array $params = [], bool $returnF
}

if (isset($params['metadata'])) {
if (method_exists($chromium, 'metadata')) {
$chromium->metadata($params['metadata']);
} else {
$chromium->formValue('metadata', json_encode($params['metadata']));
}
// TODO: Replace with metadata() once dropping support for gotenberg-php < 2.2.0
$chromium->formValue('metadata', json_encode($params['metadata']));

}

$request = $chromium->outputFilename($tempFileName)->html(Stream::string('processor.html', $html));
Expand Down

0 comments on commit 437b18f

Please sign in to comment.