tcpdf rotate confusion

I spent the last few days fighting with dynamic generation of pdf files using the tcpdf php library.

tcpdf is not well documented, so much of the process of getting it to work is trial and error (and error and error...)

The one thing that really kicked my ass was trying to print an item rotated 90 degrees, and then getting another rotated item to print where I wanted it. Finally after reading the documentation a dozen times, I saw that my answer was there but is not all that clear.

If you want to have control over more than one rotated item, you have to add a line to start and end each rotation/transformation

for example, while it seems like it should, the following code does not position the barcode in the right place, it insists on placing it on the same y axis as the username

//print username
$pdf->setXY(71,3);
$pdf->SetFont('helvetica', 'b', 10);
$pdf->Rotate(-90);
$pdf->write(2,$userinfo->name);
$pdf->Ln();
//print barcode of uid
$pdf->setXY(18,45);
$pdf->SetTextColor(0,0,0);
$pdf->write1DBarcode($userinfo->uid, "C128A", '', '', 45, 4, 0.4,'', 'N');

but, adding in the start and stop transform commands as follows did exactly what I wanted

//print username
$pdf->setXY(71,3);
$pdf->SetFont('helvetica', 'b', 10);
$pdf->StartTransform();
$pdf->Rotate(-90);
$pdf->write(2,$userinfo->name);
$pdf->Ln();
//print barcode of uid
$pdf->StopTransform();
$pdf->setXY(0,0);
$pdf->StartTransform();
$pdf->SetTextColor(0,0,0);
$pdf->Rotate(-90,18,45);
$pdf->write1DBarcode($userinfo->uid, "C128A", '', '', 45, 4, 0.4,'', 'N');
$pdf->StopTransform();

I don't have to kill myself now

I was about to jump out the window after hours of debugging on this exact problem. Thanks! I'm sure the garbage men thank you also, the 23 floor fall would have made a big mess.

hello

Good work! Your post/article is an excellent example of why I keep comming back to read your excellent quality content that is forever updated. Thank you!

como rotar dentro de una tabla html

hola esta muy bien pero... ¿como puedo rotar texto dentro de una tabla html ?

hola

hola

si la tabla html esta un elemento, es imposible a rotar un elemento dentro la tabla, pero si las células de la tabla estan elementos individual su rote el texto como se describe