Posted By

on 04/20/09


Tagged

php pfdf


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


salto de linea en PFDF (generador de PDFs en PHP)


 / Published in: PHP
 

URL: http://www.fpdf.org/

si les ha pasado que imprimen una cadena que toma mas de una linea, este codigo ayuda a hacer un salto extra para que el texto no se sobreponga. está medio feo pero se entiende la idea de usar GetY para saber la altura actual y luego modificar $start

  1. $h = 1 ; // heigh for short text
  2. $h2 = 2; // heigh for 2 liner text
  3. $high = 0;
  4. $high2 = 0;
  5.  
  6.  
  7. $high = $pdf->GetY() ;
  8. $pdf->TextCell("". $porderd_rs[1], 27, $start, 95, "L" ) ;
  9. $high2 = $pdf->GetY() ;
  10.  
  11.  
  12. // si la altura es mayor porque se imprimió una linea que tomó dos lineas, entonces se hace un salto
  13. // ya se que está mal escrito high xD
  14. if ($high2 > $high)
  15. $start = $h2 + $high2 ;
  16. else
  17. $start = $h + $high ;

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: hesham on April 20, 2009

1. $h = 1 ; // heigh for short text 2. $h2 = 2; // heigh for 2 liner text 3. $high = 0; 4. $high2 = 0; 5.

6.

7. $high = $pdf->GetY() ; 8. $pdf->TextCell("". $porderd_rs[1], 27, $start, 95, "L" ) ; 9. $high2 = $pdf->GetY() ; 10.

11.

12. // si la altura es mayor porque se imprimió una linea que tomó dos lineas, entonces se hace un salto 13. // ya se que está mal escrito high xD 14. if ($high2 > $high) 15. $start = $h2 + $high2 ; 16. else 17. $start = $h + $high ;

Posted By: hesham on April 20, 2009

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

Posted By: hesham on April 20, 2009

how to make administretor

Posted By: hesham on April 20, 2009

dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

You need to login to post a comment.