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.
| Constant | Event name | Dispatched when | Event object and arguments |
|---|---|---|---|
PRINT_PRE_PDF_GENERATION | pimcore.document.print.prePdfGeneration | Before the PDF is generated | Pimcore\Event\Model\DocumentEvent with processor and jobConfig |
PRINT_POST_PDF_GENERATION | pimcore.document.print.postPdfGeneration | After the PDF has been generated | DocumentEvent with filename and pdf |
PRINT_MODIFY_PROCESSING_OPTIONS | pimcore.document.print.processor.modifyProcessingOptions | While the processor builds the list of options shown in the print settings form | Event\Model\PrintConfigEvent with options |
PRINT_MODIFY_PROCESSING_CONFIG | pimcore.document.print.processor.modifyConfig | Immediately before the processor renders the PDF | PrintConfigEvent, arguments differ per processor, see below |
Both MODIFY_* events are dispatched by both processors, but they do not carry the same arguments:
| Processor | PRINT_MODIFY_PROCESSING_CONFIG arguments |
|---|---|
| PDFReactor | config, reactorConfig, document |
| Gotenberg | params, 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\.
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 name | Payload | Dispatched when | Use it to |
|---|---|---|---|
pre_response.web_to_print.generate_process_data | Schema\GenerateProcessData | When Studio polls the status of a running PDF generation | Add your own fields to the generation status payload |
pre_response.web_to_print.processing_option | Schema\ProcessingOption | Once per option, while the processor options are assembled | Annotate individual processor options shown in the print settings form |
pre_response.web_to_print.settings | Schema\WebToPrintSettings | When the global web-to-print settings are requested | Add your own fields to the settings response |