Working with TCPDF tags

Fooman Pdf extensions use the TCPDF library under the hood to convert from a rudimentary html input to the final pdf output. One of the more advanced features is to directly affect the pdf from within the phtml theme files input via tcpdf tags:

<tcpdf method="SetY" <?= /* @noEscape */ $block->getEncodedParams([10]) ?> />

Starting from version 6.7.1 what is allowed to be used as method is determined via an allowlist.

This allowlist is configured viadi.xml instructions:

<type name="Fooman\PdfCore\Model\Tcpdf\Defaults">
    <arguments>
        <argument name="allowedTcpdfTags" xsi:type="array">
            <item name="Image" xsi:type="string">Image</item>
            <item name="ImageSVG" xsi:type="string">ImageSVG</item>
            <item name="write1DBarcode" xsi:type="string">write1DBarcode</item>
            <item name="write2DBarcode" xsi:type="string">write2DBarcode</item>
            <item name="SetFillColor" xsi:type="string">SetFillColor</item>
            <item name="writeHTMLCell" xsi:type="string">writeHTMLCell</item>
            <item name="SetX" xsi:type="string">SetX</item>
            <item name="SetY" xsi:type="string">SetY</item>
            <item name="SetXY" xsi:type="string">SetXY</item>
            <item name="Rect" xsi:type="string">Rect</item>
            <item name="Line" xsi:type="string">Line</item>
        </argument>
    </arguments>
</type>

If you are looking to use any method not covered in the default above please add this via your own custom module into the allowedTcpdfTags array argument.

Please note that using the syntax <tcpdf data="[...]" /> is not supported out of the box and would require you to utilise Tcpdf\Pdf::serializeTCPDFtag().

Still need help? Contact Us Contact Us