<?
define('FPDF_FONTPATH','Fpdf/font/');
require('Fpdf/fpdf.php');

class PDFE extends FPDF
{//inicio clase PDFE

 //cabecera de pagina
 function Header()
  {   
  } 

 //Pie de pagina.
 function Footer()
  {//inicio de la función Footer   
   $this->SetFont('Arial','I',8);   
   $this->SetY(-10);
   $this->Cell(0,10,'Página '.$this->PageNo().'/{nb}',0,0,'C');      
  }//fin de la función Footer

 /*
 x, y: top left corner of the rectangle.
 w, h: width and height.
 r: radius of the rounded corners.
 style: same as Rect(): F, D (default), FD or DF.
 */
 function RoundedRect($x, $y, $w, $h,$r, $style = '')
  {//Inicio de la funcion RoundedRect
   $k = $this->k;
   $hp = $this->h;
   
   if($style=='F')
    $op='f';
   elseif($style=='FD' or $style=='DF')
    $op='B';
   else
    $op='S';
    
   $MyArc = 4/3 * (sqrt(2) - 1);
   $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k ));
   $xc = $x+$w-$r ;
   $yc = $y+$r;
   $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k ));

   $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
   $xc = $x+$w-$r ;
   $yc = $y+$h-$r;
   $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k));
   $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
   $xc = $x+$r ;
   $yc = $y+$h-$r;
   $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k));
   $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
   $xc = $x+$r ;
   $yc = $y+$r;
   $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k ));
   $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
   $this->_out($op);
  }//Fin de la funcionRoundedRect
   
 function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
  {//Inicio de la fucnion _Arc
   $h = $this->h;
   $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k,
   $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
  }//Fin de la funcion _Arc

}//fin clase

//Creacion del objeto 
$pdf=new PDFE('P','mm','letter');
//Apertura del Documento
$pdf->SetTopMargin(5);
$pdf->Open();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAutoPageBreak(on,5);
$pdf->SetFont('Courier','B',10);
$pdf->SetLineWidth(0.5);
$pdf->RoundedRect(20,20,195,40,1.5,' ');
$pdf->SetXY(30,30);
$pdf->Cell(0,5,"Prueba del Rectangulo",0,0,'C',0);

  
$pdf->Output();
?>
