Skip to content

API reference / Quittio \ Core \ Pdf \ Renderers

CallbackRenderer

final class in quittio/core · implements PdfRenderer

Quittio\Core\Pdf\Renderers\CallbackRenderer · Source

Own rendering function (e.g. Browsershot, Gotenberg) that returns PDF binary data. PDF/A and the embedded XML are added by the post processor.

Methods#

MethodDescription
->__construct()
->render()Calls the callback with the HTML and the request and returns its PDF; the post processor adds PDF/A and the embedded XML when the request asks for them. Throws a PdfException when the callback returns no PDF.
->supportsEmbedding()PDF/A and the embedded XML are added by the post processor of this renderer.

__construct()#

public function __construct(
    Closure $callback,
    PdfPostProcessor $postProcessor = new \Quittio\Core\Pdf\PostProcessing\MpdfPostProcessor(),
)
ParameterTypeDescription
$callbackClosure
$postProcessorPdfPostProcessor = new \Quittio\Core\Pdf\PostProcessing\MpdfPostProcessor()

render()#

public function render(RenderRequest $request): string

Calls the callback with the HTML and the request and returns its PDF; the post processor adds PDF/A and the embedded XML when the request asks for them. Throws a PdfException when the callback returns no PDF.

ParameterTypeDescription
$requestRenderRequest
Returns
string

supportsEmbedding()#

public function supportsEmbedding(): bool

PDF/A and the embedded XML are added by the post processor of this renderer.

Returns
bool

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.