| Hook | actionGetPdfRenderer |
|---|---|
| Locations | BO |
| Type | action |
| Origin | core |
| Aliases | |
| Description | This hook allows modules to provide a custom PDF renderer (PDFGenerator) for generating PDF documents like invoices, delivery slips, and order returns. |
This hook has an $array_return parameter set to true (module output will be set by name in an array, see explaination here).
| Origin | File |
|---|---|
| core | classes/pdf/PDF.php |
[
'template' => $template, // Template type string (e.g., 'Invoice', 'OrderReturn')
'orientation' => $orientation, // Page orientation ('P' for portrait, 'L' for landscape)
]
Return a PDFGenerator instance to use a custom renderer, or null to use the default TCPDF-based renderer.
$renderers = Hook::exec(
'actionGetPdfRenderer',
[
'template' => $template,
'orientation' => $orientation,
],
null,
true
);
public function hookActionGetPdfRenderer($params)
{
// Use a custom PDF library for all templates
return new MyCustomPdfGenerator($params['orientation']);
}
This hook is useful when you need to: