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dh+)ռ?ʀ\q0h2/a삂;GPFpzнg ܟt,fQwwV@h}ΰ!6Qي-g6Feՙvuu-\@$!3SoT sNx`EҤ}XbфrO'o |J-vSBH7j,Fa0>ѣw{*JPςHOւm}?W`N-ڟQǵC 5Y($ k7ѷ)įdB>GE`;qAbUĎ66V/$jHwM$ aCZom>=Tj!'v_Vhq|A׍BE~>˦9d2mP/m[fJ&7“< q`o6\c؜N =s*XRr[j%eVҠl`!}~7+P~tDr0Tg-T_RI!E| 9ݣ}vN~. .'YuӬ{(oȭz)5[01֔qKi07;^S<$'f HG`8Lo6\c؜ L4>8ayjJ5>Wr~;o~RH0:\UYB :URB4^?Q+*ލFHh6Mԟ,@ àVVKi07;W$&x׫o6\c؜qo+XY|lGB}z XlnujwZy?c+aX? S~ W_&gl ͋Wr&&an>220,255); // Ttulo $this->Cell(0,6,"Captulo $num : $label",0,1,'L',true); // Salto de lnea $this->Ln(4); } function ChapterBody($file) { // Leemos el fichero $txt = file_get_contents($file); // Times 12 $this->SetFont('Times','',12); // Imprimimos el texto justificado $this->MultiCell(0,5,$txt); // Salto de lnea $this->Ln(); // Cita en itlica $this->SetFont('','I'); $this->Cell(0,5,'(fin del extracto)'); } function PrintChapter($num, $title, $file) { $this->AddPage(); $this->ChapterTitle($num,$title); $this->ChapterBody($file); } } $pdf = new PDF(); $title = '20000 Leguas de Viaje Submarino'; $pdf->SetTitle($title); $pdf->SetAuthor('Julio Verne'); $pdf->PrintChapter(1,'UN RIZO DE HUIDA','20k_c1.txt'); $pdf->PrintChapter(2,'LOS PROS Y LOS CONTRAS','20k_c2.txt'); $pdf->Output(); ?>

[Demo]

El mtodo GetStringWidth() le permite determinar la longitud de una cadena en el tipo de letra actual, y se usa aqu para calcular la posicin y ancho del borde que rodea al ttulo. Despus se establecen los colores (mediante SetDrawColor(), SetFillColor() y SetTextColor()) y el borde de la lnea se establece en 1 mm (en contra de los 0,2 por defecto) con SetLineWidth(). Finalmente, imprimimos la celda (el ltimo parmetro a 1 indica que debe colorearse el fondo).

El mtodo usado para imprimir los prrafos es MultiCell(). Cada vez que la lnea llega al extremo derecho de la celda o aparece un carcter de fin de lnea, se ejecuta un salto de lnea y se crea automticamente otra celda debajo de la actual. El texto se encuentra justificado por defecto.

Se definen dos propiedades del documento: ttulo (SetTitle()) y autor (SetAuthor()). Las propiedades pueden verse de dos maneras. La primera es abrir el documento directamente con Adobe Reader, vaya al men Archivo y seleccione la opcin Propiedades del documento. La segunda, tambin disponible desde el plug-in, es hacer clic con el botn derecho y seleccione Propiedades del documento.