Skip to main content
Version: Next

Events

The bundle dispatches two kinds of events: PDF generation events, which let you hook into the rendering process itself, and Studio pre-response events, which let you extend the payloads Studio receives.

PDF Generation Events

These are the extension points for the PDF pipeline. All constants are defined in Pimcore\Bundle\WebToPrintBundle\Event\DocumentEvents.

ConstantEvent nameDispatched whenEvent object and arguments
PRINT_PRE_PDF_GENERATIONpimcore.document.print.prePdfGenerationBefore the PDF is generatedPimcore\Event\Model\DocumentEvent with processor and jobConfig
PRINT_POST_PDF_GENERATIONpimcore.document.print.postPdfGenerationAfter the PDF has been generatedDocumentEvent with filename and pdf
PRINT_MODIFY_PROCESSING_OPTIONSpimcore.document.print.processor.modifyProcessingOptionsWhile the processor builds the list of options shown in the print settings formEvent\Model\PrintConfigEvent with options
PRINT_MODIFY_PROCESSING_CONFIGpimcore.document.print.processor.modifyConfigImmediately before the processor renders the PDFPrintConfigEvent, arguments differ per processor, see below

Both MODIFY_* events are dispatched by both processors, but they do not carry the same arguments:

ProcessorPRINT_MODIFY_PROCESSING_CONFIG arguments
PDFReactorconfig, reactorConfig, document
Gotenbergparams, html

Check the processor before reading arguments, as in the worked example in Extending PDF Creation Config for PDF/X Conformance. A listener written only against PDFReactor's arguments will break when the same event fires from Gotenberg.

Studio Pre-Response Events

The bundle builds its Studio responses through the Pimcore Studio Backend Bundle. Before a response is returned, it dispatches a pre-response event carrying the response object, so you can attach your own data without replacing the controller behind it. See Additional and Custom Attributes for how additional attributes reach the Studio frontend.

Event classes live in Pimcore\Bundle\WebToPrintBundle\Event\PreResponse\.

warning

The Studio controllers that dispatch these events are marked @internal and change without deprecation. Listen to the events to enrich the responses, but do not call the endpoints themselves. Studio Backend serves generated OpenAPI documentation at /pimcore-studio/api/docs.

Event namePayloadDispatched whenUse it to
pre_response.web_to_print.generate_process_dataSchema\GenerateProcessDataWhen Studio polls the status of a running PDF generationAdd your own fields to the generation status payload
pre_response.web_to_print.processing_optionSchema\ProcessingOptionOnce per option, while the processor options are assembledAnnotate individual processor options shown in the print settings form
pre_response.web_to_print.settingsSchema\WebToPrintSettingsWhen the global web-to-print settings are requestedAdd your own fields to the settings response