[Maintenance][DX] Add support for PDF generation abstraction#493
Open
NoResponseMate wants to merge 1 commit intoSylius:2.1from
Open
[Maintenance][DX] Add support for PDF generation abstraction#493NoResponseMate wants to merge 1 commit intoSylius:2.1from
NoResponseMate wants to merge 1 commit intoSylius:2.1from
Conversation
fd998bd to
2a83f6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for
sylius/pdf-generation-bundleas a modern alternative to the legacy PDF generation setup based onKnpSnappyBundlewith a hardcodedwkhtmltopdfbinary.The new integration is opt-in and fully backward compatible — existing setups continue to work without any changes.
Motivation
The current PDF generation in RefundPlugin is tightly coupled to
KnpSnappyBundleandwkhtmltopdf. Thesylius/pdf-generation-bundleprovides a proper abstraction layer with support for multiple adapters, context-based configuration, and a unified filesystem management — making it easier to swap PDF engines or customize the generation pipeline.How to use it
To switch from the legacy PDF generation to the new bundle, set the
legacyoption tofalsein your configuration:That's it. The plugin automatically configures a
sylius_refundcontext insylius/pdf-generation-bundlewith theknp_snappyadapter andgaufrettestorage, making it a drop-in replacement.For more details on available adapters, storage options, and custom option processors, refer to the
sylius/pdf-generation-bundledocumentation.Deprecations
The following classes and interfaces are deprecated and will be removed in 3.0:
TwigToPdfGeneratorInterfaceTwigToPdfRendererInterfacefromsylius/pdf-generation-bundleTwigToPdfGeneratorTwigToPdfRendererInterfacefromsylius/pdf-generation-bundlePdfOptionsGeneratorInterfacesylius/pdf-generation-bundlePdfOptionsGeneratorsylius/pdf-generation-bundleCreditMemoFileManagerInterfacePdfFileManagerInterfacefromsylius/pdf-generation-bundleCreditMemoFileManagerPdfFileManagerfromsylius/pdf-generation-bundleThe corresponding services (
sylius_refund.generator.twig_to_pdf,sylius_refund.generator.pdf_options,sylius_refund.manager.credit_memo_file) are also deprecated.Issues
Fixes #329, fixes #480