Didn't work for me, I applied the changes suggested by compusolver, to no avail. At last I got it working. I paste the fixed code:
class PDF extends FPDF {
public $angle = 0;
function Rotate($angle,$x=-1,$y=-1) {
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out('Q');
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm',$c,$s,-$s,$c,$cx,$cy,-$cx,-$cy));
}
}
}
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial','',10);
$pdf->Write(20,'this text is straight');
$pdf->Rotate(10);
$pdf->Write(20,'this text is crooked');
$pdf->Rotate(0);
$pdf->Write(20,'this text is straight again');
$pdf->Output();