Foros del Web » Programando para Internet » PHP »

Salto de pagina

Estas en el tema de Salto de pagina en el foro de PHP en Foros del Web. Hola que tal gente, tengo un problema, mejor dicho una duda, estoy haciendo un pdf con fpdf le he hecho una funcion Header() y Footer() ...
  #1 (permalink)  
Antiguo 04/02/2011, 19:29
 
Fecha de Ingreso: enero-2011
Mensajes: 11
Antigüedad: 13 años, 3 meses
Puntos: 0
Salto de pagina

Hola que tal gente, tengo un problema, mejor dicho una duda, estoy haciendo un pdf con fpdf le he hecho una funcion Header() y Footer() el cuerpo del pdf son tablas de un formulario que he traido con POST, lo que sucede es que al pasar al pdf las tablas al momento de saltar la pagina se quedan partidas, no se si me explico, las tablas qdan interrumpidas unas columnas en una pagina y las otras columnas en la siguiente pagina, algun concejo de como corregir eso, para que tenga una buena presentacion???

Muchas gracias de antemano
  #2 (permalink)  
Antiguo 04/02/2011, 21:53
Avatar de Luis207  
Fecha de Ingreso: abril-2009
Mensajes: 52
Antigüedad: 15 años
Puntos: 0
Respuesta: Salto de pagina

Puedes poner algo del código ?
  #3 (permalink)  
Antiguo 05/02/2011, 18:58
 
Fecha de Ingreso: enero-2011
Mensajes: 11
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Salto de pagina

<?php
require("fpdf.php");
class PDF extends FPDF
{
//Cabecera de página
function Header()
{
//Logo
$this->Image('INGEMMET-2.jpg',25,10,120); // ('imagen',izquierda,abajo,anchura)
//Salto de línea
$this->Ln(18);
//Movernos a la derecha
$this->Cell(56);
//Times New Roman normal 10
$this->SetFont('Times','',10);
//Año
$this->Cell(30,10,'"Año del Centenario de Machu Pichu para el mundo"');
//Salto de línea
$this->Ln(12);
}
//Informacion del Reporte
function Information()
{
//Arial normal 11
$this->SetFont('Arial','',11);
//Movernos a la derecha
$this->Cell(64);
//Titulo
$this->Cell(30,10,'DIRECCION DE LABORATORIOS');
//Salto de línea
$this->Ln(4);
//Movernos a la derecha
$this->Cell(66);
//Titulo
$this->Cell(30,10,'LABORATORIO DE RAYOS "X"');
//Salto de línea
$this->Ln(9);
//Movernos a la derecha
$this->Cell(17);
//Arial subrayado 11
$this->SetFont('Arial','U',11);
//Reporte
$this->Cell(30,10,'REPORTE DE RESULTADOS DE ANALISIS MINERALOGICO POR DIFRACCION');
//Salto de línea
$this->Ln(4);
//Movernos a la derecha
$this->Cell(17);
//Reporte
$this->Cell(30,10,'DE RAYOS "X" N° '.$_POST["F1"].'-'.$_POST["F2"].'/DL/LRX');
//Arial normal 11
$this->SetFont('Arial','',11);
//Salto de línea
$this->Ln(9);
//Movernos a la derecha
$this->Cell(17);
//Solicitud
$this->Cell(30,10,'SOLICITUD');
//Movernos a la derecha
$this->Cell(17);
//:
$this->Cell(30,10,':');
//Salto de línea SIN salto
$this->Ln(0);
//Movernos a la derecha
$this->Cell(80);
//S1-S2-S3
$this->Cell(30,10,''.$_POST["S1"].'-'.$_POST["S2"].'-'.$_POST["S3"].'');
//Salto de línea
$this->Ln(5);
//Movernos a la derecha
$this->Cell(17);
//Referencia
$this->Cell(30,10,'REFERENCIA');
//Movernos a la derecha
$this->Cell(17);
//:
$this->Cell(30,10,':');
//Salto de línea SIN salto
$this->Ln(0);
//Movernos a la derecha
$this->Cell(80);
//S1-S2-S3
$this->Cell(30,10,''.$_POST["R1"].'-'.$_POST["R2"].'-'.$_POST["R3"].''.$_POST["R4"].''.$_POST["R5"].'');
//Salto de línea
$this->Ln(5);
//Movernos a la derecha
$this->Cell(17);
//Numero de muestras
$this->Cell(30,10,'N° DE MUESTRAS');
//Movernos a la derecha
$this->Cell(17);
//:
$this->Cell(30,10,':');
//Salto de línea SIN salto
$this->Ln(0);
//Movernos a la derecha
$this->Cell(80);
//NUMERO DE MUESTRAS ---------> N
$this->Cell(30,10,''.$_POST["N"].'');
//thislto de línea
$this->Ln(5);
//Movernos a la derecha
$this->Cell(17);
//Fecha
$this->Cell(30,10,'FECHA');
//Movernos a la derecha
$this->Cell(17);
//:
$this->Cell(30,10,':');
//Salto de línea SIN salto
$this->Ln(0);
//Movernos a la derecha
$this->Cell(80);
//day month year
$this->Cell(30,10,'Lima, '.$_POST["day"].' de '.$_POST["month"].' de '.$_POST["year"].'');
//Salto de línea
$this->Ln(5);
//Movernos a la derecha
$this->Cell(17);
//Arial subrayado 17
$this->SetFont('Arial','U',17);
//Blank
$this->Cell(30,10,' ');
//Arial normal 11
$this->SetFont('Arial','',11);
//Salto de línea
$this->Ln(10);
//Movernos a la derecha
$this->Cell(17);
//Infomracion
$this->Cell(30,10,'Para el analisis, se utilizo tubo de Cu en un difractometro SHIMADZU modelo XRD-6000,');
//Salto de línea
$this->Ln(4);
//Movernos a la derecha
$this->Cell(17);
//Informacion
$this->Cell(30,10,'con energia de 40 Kv 30 mA');
//Salto de línea
$this->Ln(10);
//Movernos a la derecha
$this->Cell(17);
//Resultados:
$this->Cell(30,10,'Resultados:');
//Salto de línea
$this->Ln(10);
}
//Tabla simple
function BasicTable($header1,$header2,$header3,$header4,$i, $numFilas)
{
//Movernos a la derecha
$this->Cell(17);
//Nombre
$this->Cell(30,10,''.$_POST["nombre".$i.""].'');
//Salto de línea
$this->Ln(8);
//Movernos a la derecha
$this->Cell(18);
//Cabecera
foreach($header1 as $col)
$this->Cell(20,7,$col,1);
foreach($header2 as $col)
$this->Cell(50,7,$col,1);
foreach($header3 as $col)
$this->Cell(70,7,$col,1);
foreach($header4 as $col)
$this->Cell(20,7,$col,1);
//Salto de línea
$this->Ln(7);
//Movernos a la derecha
$this->Cell(18);
//Datos
for($f=0;$f<$numFilas;$f++)
{
$q=$f+1;
if($q<10)
{
$data1=array(' 0'.$q.'');
}
else
{
$data1=array(' '.$q.'');
}
foreach($data1 as $col)
$this->Cell(20,6,$col,1);
$data2=array(''.$_POST["celda".$i."".$f."0"].'');
foreach($data2 as $col)
$this->Cell(50,6,$col,1);
$data3=array(''.$_POST["celda".$i."".$f."1"].'');
foreach($data3 as $col)
$this->Cell(70,6,$col,1);
$data4=array(' '.$_POST["celda".$i."".$f."2"].'');
foreach($data4 as $col)
$this->Cell(20,6,$col,1);
$this->Ln(6);
//Movernos a la derecha
$this->Cell(18);
}

}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-25);
//Arial normal 9
$this->SetFont('Arial','',9);
//Direccion
$this->Cell(0,10,'Av. Canada 1470, San Borja - Apartado 889 Lima 41, Peru',0,0,'C');
//Salto de línea
$this->Ln(4);
//Telefono
$this->Cell(0,10,'Telefono: 618-9800 - Fax: (051-1) 225-3063 / (051-1) 225-4540 / (051-1) 476-7010',0,0,'C');
//Salto de línea
$this->Ln(4);
//Web
$this->Cell(0,10,'http://www.ingemmet.gob.pe E-mail: [email protected]',0,0,'C');
}
}
//Creación del objeto de la clase heredada
$pdf=new PDF();
$pdf->AddPage();
$pdf->Information();
//Títulos de las columnas
$header1=array(' N°');
$header2=array(' Mineral');
$header3=array(' Formula');
$header4=array(' %');
$N=$_POST["N"];
for ($i=0;$i<$N;$i++)
{
$numFilas=$_POST["numFilas".$i.""];
$pdf->BasicTable($header1,$header2,$header3,$header4,$i ,$numFilas,$data1);
//Salto de línea
$pdf->Ln(6);
}
$pdf->Output();
?>

Etiquetas: salto
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:10.