Ver Mensaje Individual
  #8 (permalink)  
Antiguo 18/07/2011, 18:18
Avatar de gildus
gildus
 
Fecha de Ingreso: agosto-2003
Mensajes: 1.495
Antigüedad: 20 años, 9 meses
Puntos: 105
Respuesta: PDF dinamico con Texto como marca de agua

No puedes bajar el archivo? que raro, te pongo aqui el codigo por seacaso, y es el mismo que viene en el adjunto del link:

El archivo fpdf.php lo puedes bajar de la misma pagina:

Archivo: rotation.php
Código PHP:
Ver original
  1. <?php
  2. require('fpdf.php');
  3.  
  4. class PDF_Rotate extends FPDF
  5. {
  6. var $angle=0;
  7.  
  8. function Rotate($angle,$x=-1,$y=-1)
  9. {
  10.     if($x==-1)
  11.         $x=$this->x;
  12.     if($y==-1)
  13.         $y=$this->y;
  14.     if($this->angle!=0)
  15.         $this->_out('Q');
  16.     $this->angle=$angle;
  17.     if($angle!=0)
  18.     {
  19.         $angle*=M_PI/180;
  20.         $c=cos($angle);
  21.         $s=sin($angle);
  22.         $cx=$x*$this->k;
  23.         $cy=($this->h-$y)*$this->k;
  24.         $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));
  25.     }
  26. }
  27.  
  28. function _endpage()
  29. {
  30.     if($this->angle!=0)
  31.     {
  32.         $this->angle=0;
  33.         $this->_out('Q');
  34.     }
  35.     parent::_endpage();
  36. }
  37. }
  38. ?>


Archivo: watermark.php
Código PHP:
Ver original
  1. <?php
  2. require('rotation.php');
  3.  
  4. class PDF extends PDF_Rotate
  5. {
  6. function Header()
  7. {
  8.     //Put the watermark
  9.     $this->SetFont('Arial','B',50);
  10.     $this->SetTextColor(255,192,203);
  11.     $this->RotatedText(35,190,'W a t e r m a r k   d e m o',45);
  12. }
  13.  
  14. function RotatedText($x, $y, $txt, $angle)
  15. {
  16.     //Text rotated around its origin
  17.     $this->Rotate($angle,$x,$y);
  18.     $this->Text($x,$y,$txt);
  19.     $this->Rotate(0);
  20. }
  21. }
  22.  
  23. $pdf=new PDF();
  24. $pdf->AddPage();
  25. $pdf->SetFont('Arial','',12);
  26. $txt="FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say ".
  27.     "without using the PDFlib library. F from FPDF stands for Free: you may use it for any ".
  28.     "kind of usage and modify it to suit your needs.\n\n";
  29. for($i=0;$i<25;$i++)
  30.     $pdf->MultiCell(0,5,$txt,0,'J');
  31. $pdf->Output();
  32. ?>


Saludos
__________________
.: Gildus :.