Foros del Web » Programando para Internet » PHP »

Como puedo generar este pdf

Estas en el tema de Como puedo generar este pdf en el foro de PHP en Foros del Web. Hola amigos del foro. saludos a todos y espero que me puedan ayudar en esta consulta: tengo la sgte. tabla codigo|nombre|pais|edad 1 |juan |peru|23 2 ...
  #1 (permalink)  
Antiguo 10/11/2008, 01:44
 
Fecha de Ingreso: octubre-2005
Ubicación: Perú
Mensajes: 303
Antigüedad: 18 años, 6 meses
Puntos: 0
Sonrisa Como puedo generar este pdf

Hola amigos del foro. saludos a todos y espero que me puedan ayudar en esta consulta:

tengo la sgte. tabla


codigo|nombre|pais|edad
1 |juan |peru|23
2 |alicia |peru|18
3 |mario |argentina|22
4 |luis |chile|34
5 |maria |chile|29
6 |pedro |bolivia|33
.
.
.n registros




quiero generar un pdf con la sgte estructura

Código HTML:
1 juan     2 alicia       3 mario
peru 23   peru 18     argentina 22
 
4 luis       5 maria      6 pedro
chile 34   chile 29     bolivia 33
 
.
.
.
n registros
como podria hacerlo con fpdf o tcpdf?

alguien tiene algun ejemplo o una idea. pense hacerlo con tablas html usando alguna de esas clases, peor nos e si sera exacta la impresion.

alguien me puede ayudar.

gracias de antemano.
__________________
DESARROLLO Y DISEÑO DE PAGINAS WEB, HOSTING, DOMINIO, TRUJILLO PERU
Diseño web
Trujillo - Perú
  #2 (permalink)  
Antiguo 10/11/2008, 03:36
 
Fecha de Ingreso: abril-2008
Mensajes: 144
Antigüedad: 16 años
Puntos: 1
De acuerdo Respuesta: Como puedo generar este pdf

Cita:
Iniciado por andresweb Ver Mensaje
Hola amigos del foro. saludos a todos y espero que me puedan ayudar en esta consulta:

tengo la sgte. tabla


codigo|nombre|pais|edad
1 |juan |peru|23
2 |alicia |peru|18
3 |mario |argentina|22
4 |luis |chile|34
5 |maria |chile|29
6 |pedro |bolivia|33
.
.
.n registros




quiero generar un pdf con la sgte estructura

Código HTML:
1 juan     2 alicia       3 mario
peru 23   peru 18     argentina 22
 
4 luis       5 maria      6 pedro
chile 34   chile 29     bolivia 33
 
.
.
.
n registros
como podria hacerlo con fpdf o tcpdf?

alguien tiene algun ejemplo o una idea. pense hacerlo con tablas html usando alguna de esas clases, peor nos e si sera exacta la impresion.

alguien me puede ayudar.

gracias de antemano.
yo haria algo asi...

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

//aqui la consulta o lo que sea...


    
$pdf=new FPDF(); 
    
$pdf->AddPage(); 
    
$pdf->SetFont('Arial','B','10'); 

 
//titulos de las tabals.....
    
$pdf->Cell(60,20,'Ultim Control',C);
    
$pdf->Cell(20,20,'Vaca/Codi');
    
$pdf->Cell(50,10,'Datacontrol');
    
$pdf->Cell(25,5,'LLET');

//resultados de la consulta a la BD

while($row mysql_fetch_array($result)) {     
    
$pdf->Cell(20,20,$row["codi"]);
       
$pdf->Cell(50,10,$row["testdate"]);
    
$pdf->Cell(25,5,$row["milk"]); 
    
    
    
    
    
    
    
/*$pdf->Cell(60,20,'PDF+PHP Test',);
rectangle with 60 mm of width & 20 mm of height, we wrote ‘PDF+PHP Test’ and the first 0 means we do not want a border. The 1 next to it means that once it’s done the cell, it will go to the beginning of the next line, if 0 is provided, then it will be to the right of it, if 2 is provided then it will go below. The C is just the alignment which is center of the text inside the box, possible values are left (L), center (C), right (R).*/ 
    
$pdf->Ln(5); 
    
        }
 
$pdf->Output(); 
/*Now let’s see that code line by line…

require('fpdf.php');
This line includes our FPDF class that we need to create the PDF file.

$pdf=new FPDF();
This line creates a new instance of the FPDF class which will be binded to $pdf

$pdf->AddPage();
This line tells FPDF to add a new page to the PDF file; obviously we need one page so we will call this function once.

$pdf->SetFont('Arial','B',16);
This line tells the FPDF class to change the font to Arial, bold, 16 pt.

$pdf->Cell(40,10,'Hello World!');
This line is just like the “echo” of PHP, the text fields in PDF files are just sort of rectangles with text in them, so we want the width of 40 pt. and a height of 10 pt., the third value is the text to be written in that rectangular box.*/
?>
suerte :)
  #3 (permalink)  
Antiguo 10/11/2008, 04:59
 
Fecha de Ingreso: octubre-2005
Ubicación: Perú
Mensajes: 303
Antigüedad: 18 años, 6 meses
Puntos: 0
Respuesta: Como puedo generar este pdf

Gracias amigo bellleti, por tu ayuda, pero el codigo que me pones segun veo me generaria un listado de 1 columnas y n filas. Lo que necesito es que me genere un listado de 3 columnas n filas. asi:

Código HTML:
 
1 juan     | 2 alicia     |  3 mario
peru 23   | peru 18   |  argentina 22
 ----------------------------------------------
4 luis      | 5 maria    |  6 pedro
chile 34  | chile 29    | bolivia 33
 
.
.
.
n registros
 
 
__________________
DESARROLLO Y DISEÑO DE PAGINAS WEB, HOSTING, DOMINIO, TRUJILLO PERU
Diseño web
Trujillo - Perú
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 09:17.