Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass metadata to gotenberg-chromium processor #66

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
muratbinerbay marked this conversation as resolved.
Show resolved Hide resolved
"chrome-php/chrome": "^1.8",
"codeception/codeception": "^5.0.3",
"codeception/module-symfony": "^3.1.0",
Expand Down
9 changes: 9 additions & 0 deletions src/Processor/Gotenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@
$chromium->extraHttpHeaders($params['extraHttpHeaders']);
}

if (isset($params['metadata'])) {
if (method_exists($chromium, 'metadata')) {
$chromium->metadata($params['metadata']);
} else {
/* @phpstan-ignore-next-line */
$chromium->formValue('metadata', json_encode($params['metadata']));

Check failure on line 167 in src/Processor/Gotenberg.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.1, mariadb:10.11, lowest, false)

No error to ignore is reported on line 167.
muratbinerbay marked this conversation as resolved.
Show resolved Hide resolved
}
}

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

if ($returnFilePath) {
Expand Down
Loading