pimcore / web-to-print-bundle

Web-to-Print community bundle adds web-to-print features to Pimcore documents.
https://pimcore.com/docs/platform/Web_To_Print/
Other
4 stars 12 forks source link

Pass metadata to gotenberg-chromium processor #66

Closed muratbinerbay closed 4 months ago

muratbinerbay commented 6 months ago

This will let us pass metadata to the PDF file like title, author, copyright, and creation date.

Documentation links:

github-actions[bot] commented 6 months ago

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

muratbinerbay commented 6 months ago

I have read the CLA Document and I hereby sign the CLA

muratbinerbay commented 6 months ago

recheck

muratbinerbay commented 6 months ago

@kingjia90 on v2.2.0 the formValue has protected access. I reverted last 2 commits to what @blankse suggested.

https://github.com/gotenberg/gotenberg-php/blob/main/src/MultipartFormDataModule.php#L92

blankse commented 6 months ago

@muratbinerbay @kingjia90 The formValue is only in 1.1.8 public. See: https://github.com/gotenberg/gotenberg-php/commit/33298eb81eb8e63fb0aaca71607f98b553a3bb50 https://github.com/gotenberg/gotenberg-php/commit/993384d30dadc6cb74b8e2daa1355756f9fbf331 So we need to bump the version in composer, right? "gotenberg/gotenberg-php": "^1.1.8 || ^2.2",

kingjia90 commented 6 months ago

So many plot twists 😄 Thank you for the changes. It seems that PHPStan is triggering some false positive i guess, do we need to mute these?

blankse commented 6 months ago

@kingjia90 Yes PhpStan doesn't want the formValue method because it is protected in 2.2. But it isn't reachable there.

muratbinerbay commented 6 months ago

@blankse @kingjia90 do we want to try something like ReflectionMethod. Seems rather excessive to me but I'm willing to try it :)

blankse commented 6 months ago

Doesn't work :(

I think we need the same construct like in pimcore/pimcore. We have there a own phpstan config for lowest with reportUnmatchedIgnoredErrors: false: https://github.com/pimcore/pimcore/blob/11.x/phpstan-lowest.neon

So we can create a phpstan baseline with the highest dependencies.

blankse commented 6 months ago

Of course, we could also process the metadata with version 2.2 only, if that is an alternative :)

muratbinerbay commented 6 months ago

Of course, we could also process the metadata with version 2.2 only, if that is an alternative :)

would also be acceptable in my opinion, @kingjia90 what do you think?

kingjia90 commented 6 months ago

That would be also fine to me, no any objection, but it seems that then it would need a doc or changelog entry (as example) to better explain that "difference" (that metadata is available only if you use gotenberg-php 2.2+ )

maybe let's have a final confirmation by @fashxp first on how to proceed

muratbinerbay commented 6 months ago

Hi @kingjia90 @fashxp, just wanted to ping you to check if I can go ahead and make the metadata available only for gotenberg-php:2.2+ ? Thanks!

kingjia90 commented 4 months ago

Thank you for your patience @muratbinerbay !

I think it would be fine to support metadata only for 2.2+ and we can proceed with that, we also have a similar situation with the screenshot feature in 2.0 and it's "diverging" more and more in what one version can do and what not, so at some point we just need to properly document the difference and recommend to use the latest when possible.