Rotate text in table - HTML
Hi, How can I rotate the text 90 degrees in HTML so that TCPDF will do it correctly? Using styles: transform: rotate(-90.0deg); unfortunately it doesn't work, a
'<tcpdf method="StartTransform"/><tcpdf method="Rotate" params="'.$pdf->serializeTCPDFtagParameters(array(90)).'"/>Text To Rotate<tcpdf method="StopTransform"/>'
sets the text outside the table cell.
My HTML code:
<table style="text-align:left; border-width:0.4px;" cellspacing="0" cellpadding="1">
<tr>
<td valign="center" style="width: 5%"><tcpdf method="StartTransform"/><tcpdf method="Rotate" params="'.$pdf->serializeTCPDFtagParameters(array(90)).'"/>Text To Rotate<tcpdf method="StopTransform"/></td>
<td valign="top" style="width: 90%">
MyContent
</td>
<td valign="center" style="width: 5%"></td>
</tr>
</table>
Hi! Did anyone found a solution for this? Thanks!
I haven't found a solution. I changed to mPDF
<tcpdf method="StartTransform"/>
<tcpdf method="Rotate" params="90"/>
Text To Rotate
<tcpdf method="StopTransform"/>
Didn't work for me either. I "fixed" this problem by manually executing those Methods on TCPDF like so:
$pdf->writeHTML('<p>I am straight</p>');
$pdf->StartTransform();
$pdf->Rotate(90);
$pdf->writeHTML('<p>I am rotated</p>');
$pdf->StopTransform();
$pdf->Output('a.pdf', 'I');
I have absolutely no clue why this doesn't work. I debugged a little and the StartTransform, Rotate and StopTransform do all actually get called through the HTML way, the same as doing it manually. But somehow it doesn't rotate 🤔