Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?
  2.     require("fpdf16/fpdf.php");
  3.     define("FPDF_FONTPATH", "fpdf16/font/");
  4.     if(!isset($_POST["btnEnviar"])){
  5.         $archivo=file("Tema9.txt");
  6.         $pdf=new FPDF("P","cm","A4");
  7.         $pdf->SetMargins($_POST["lateral"],$_POST["supInf"]);
  8.         $pdf->AddPage();
  9.         $contador=1;
  10.         foreach($archivo as $numLinea => $linea){
  11.             if($contador == 3){
  12.                         $pdf->SetAutoPageBreak(1,$_POST["supInf"]);
  13.                         $pdf->SetFont( "Helvetica", "UB");
  14.                         $pdf->SetTextColor(0,255,0);
  15.                         $pdf->write(1,utf8_decode($linea));
  16.                         $pdf->Ln(5);
  17.                         $contador = 1;
  18.             }else{
  19.                 switch($contador){
  20.                     case 1:
  21.                         $contador++;
  22.                         $pdf->SetAutoPageBreak(1,$_POST["supInf"]);
  23.                         $pdf->SetFont( "Arial", "U");
  24.                         $pdf->SetTextColor(255,0,0);
  25.                         $pdf->write(1,utf8_decode($linea));
  26.                         break;
  27.                     case 2:
  28.                         $contador++;
  29.                         $pdf->SetAutoPageBreak(1,$_POST["supInf"]);
  30.                         $pdf->SetFont( "Times", "B");
  31.                         $pdf->SetTextColor(0,0,255);
  32.                         $pdf->SetX($_POST["lateral"]+2);
  33.                         $pdf->write(1,utf8_decode($linea));
  34.                         break;
  35.                 }
  36.             }
  37.         }
  38.  
  39.         $pdf->Output();
  40.     }
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement