Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/12/2006, 13:51
Avatar de ikaroraul
ikaroraul
 
Fecha de Ingreso: octubre-2006
Ubicación: La Paz
Mensajes: 391
Antigüedad: 17 años, 7 meses
Puntos: 16
php y fpdf.php

hola que tal a todos
saben tengo un problema con la ibreria fpdf.php.

Al realizar el reporte pdf el tamaño de la hoja siempre me sale A4 y lo que quiero es cambiar ese tamaño.

como lo hariaaa

Código PHP:
<?php
require('fpdf.php');

class 
PDF extends FPDF
{
//Cargar los datos
function LoadData($file)
{
    
//Leer las líneas del fichero
    
$lines=file($file);
    
$data=array();
    foreach(
$lines as $line)
    
$data[]=explode(';',chop($line));
    return 
$data;
}

function 
LoadDataCan($file)
{
    
$linescan=file($file);
    
$datacan=array();
    foreach(
$linescan as $linecan)
    
$datacan[]=explode(';',chop($linecan));
    return 
$datacan;
}

//Tabla coloreada
function Header()
{
    
$usuario=$_COOKIE['nombrev'];
    
$this->SetFont('Arial','B',12);
    
$this->Cell(0,10,'"mi empresa."',0,0,'L');
    
$this->setXY(20,14);
    
$this->SetFont('Arial','',6);
    
$this->Cell(15,10,'mi pais',0,0,'L');
    
$this->Ln();$this->Cell(80);    
    
$this->SetFont('Arial','',12);
    
$this->Cell(80,0,'Bloques Espuma de Produccion',0,0,'C'); 
 
    
$this->SetFont('Arial','',8);
    
$this->setXY(250,20);
    
$this->Cell(0,10,'Hoja: '.$this->PageNo(),0,0,'R');
    
$this->Line (10,27,290,27);
    
    
$this->setXY(250,20);
    
$this->SetFont('Arial','B',10);
    
$this->Cell(20,0,'Nº: 157846884',0,0,'L');
    
$a=$_COOKIE['nombrev'];
    
$this->setXY(10,30);
    
$this->SetFont('Arial','I',7);
    
$this->Cell(20,0,'Usuario:'.$a.'.',0,0,'L');
    
    
$this->setXY(80,30);
    
$this->SetFont('Arial','I',7);
    
$this->Cell(20,0,'Departamento: Produccion de Bloques de Espuma',0,0,'L');
    
    
$this->setXY(10,35);
    
$this->Cell(20,1,'Fecha: '.dated.'/'.m.'/'.y),0,0,'L'); 
    
    
$this->setXY(80,35);
    
$this->Cell(20,1,'Hora : '.date('g:i:s a'),0,0,'L'); 
    
$this->SetFont('Arial','I',8);
    
    
$this->Line (10,40,290,40);    
    
$this->Ln(10);
}
 
function 
FancyTable($header,$tipo,$data,$datacan)
{
    
//Colores, ancho de línea y fuente en negrita
    
$this->SetFillColor(230,230,230);
    
$this->SetTextColor(0);
    
$this->SetDrawColor(10,0,0);
    
$this->SetLineWidth(0.1);
    
$this->SetFont('','B');
    
    
//Cabecera
    
$w=array(23,23); // Ancho y Numero de las columnas
    
$ww=array(5,13,17); // Ancho y Numero de las columnas
    
$www=array(5,13,17,23); // Ancho y Numero de las columnas
    
    
for($i=0;$i<count($header);$i++)
    
$this->Cell($ww[$i],3,$header[$i],'LRT',0,'C',1); //Ancho,Alto,Titulo,borde,estilo,Align
    
    
foreach($data as $row)
    
$this->Cell($w[0],3,$row['0'],'LRT',0,'C',1);
    
$this->Ln();
    
    for(
$i=0;$i<count($header);$i++)
    
$this->Cell($ww[$i],3,'','LRB',0,'C',1);
    
    foreach(
$data as $row)
    
$this->Cell($w[1],3,$row['1'],'LRB',0,'C',1);
    
$this->Ln();
    
$fill=0;
    foreach(
$datacan as $row)
    {
    
$this->Cell($www[0],3,$row['0'],'LRTB',0,'C',$fill);
    
$this->Cell($www[1],3,$row['1'],'LRTB',0,'C',$fill);
    
$this->Cell($www[2],3,$row['2'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['3'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['4'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['5'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['6'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['7'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['8'],'LRTB',0,'C',$fill);    
    
$this->Cell($www[3],3,$row['9'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['10'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['11'],'LRTB',0,'C',$fill);
    
$this->Cell($www[3],3,$row['12'],'LRTB',0,'C',$fill);
    
$this->Ln();
        
$fill=!$fill;
    }

        
/*
    for($i=0;$i<count($tipo);$i++)
    $this->Cell($w[$i],4,$tipo[$i],'LRB',0,'C',1); //Ancho,Alto,Titulo,borde,estilo,Align
    $this->Ln();
    */
    //Restauración de colores y fuentes
    
$this->SetFillColor(224,235,255);
    
$this->SetTextColor(0);
    
$this->SetFont('');
    
//Datos
   
    
$this->Cell(array_sum($w),0,'','T');
}
}

$pdf=new PDF();
//Títulos de las columnas
$header=array('No','Densidad','Dimensiones');


//Carga de datos
$data=$pdf->LoadData('archivo.txt');
$datacan=$pdf->LoadDataCan('archivo2.txt');

$pdf->SetFont('Arial','',7);
$pdf->AddPage('L');
$pdf->FancyTable($header,$tipo,$data,$datacan);
$pdf->Output();
?>
gracias por la yuda