Rotate Text using TCPDF

If you are rotating the text via customising one of our supplied .phtml template files

<?php
    $rotateParams = [180, '', ''];
?>
<tcpdf method="StartTransform" />
<tcpdf method="Rotate" <?= $block->getEncodedParams($rotateParams) ?> />
<div>Rotated text</div>
<tcpdf method="StopTransform" />

Please note that in the most recent releases you would also need to add the methods StartTransform, StopTransform and Rotate to the list of allowed tcpdf tags - see more details here.


From a class where \Fooman\PdfCore\Model\Tcpdf\Pdf is available like in

vendor/fooman/pdfcore-m2/src/Model/PdfRenderer.php

(or the emitted fooman_pdfcore_before_write_html event )

        $this->pdf->StartTransform();
        $this->pdf->Rotate(180);
        $this->pdf->writeHTML('<div>Rotated Text</div>', false);
        $this->pdf->StopTransform();

Still need help? Contact Us Contact Us