Foros del Web » Programando para Internet » PHP »

generar pdf e imprimir

Estas en el tema de generar pdf e imprimir en el foro de PHP en Foros del Web. Me gustaria saber si con los campos de un registro se puede crear un documento pdf para luego imprimir estos en papel ¿es posible? Si ...
  #1 (permalink)  
Antiguo 21/12/2005, 12:04
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
generar pdf e imprimir

Me gustaria saber si con los campos de un registro se puede crear un documento pdf para luego imprimir estos en papel ¿es posible?
Si es posible como se puede hacer que en ese pdf la letra sega grande a forma de un cartel anunciador??

gracias
  #2 (permalink)  
Antiguo 21/12/2005, 12:10
Avatar de caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Hola pereztroff:

Visita www.fpdf.org

Yo lo uso en mi galería de imágenes (desde mi perfil, en la galería y el botón de impresión)... A las letras puedes darle el tamaño y estilo que quieras...

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo
  #3 (permalink)  
Antiguo 21/12/2005, 16:56
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Gracias Caricatos voy a revisarlo ahora mismo.
  #4 (permalink)  
Antiguo 21/12/2005, 17:29
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Hice la primera prueba y me dio error, ¿que significa?:

Warning: setfont(helveticab.php): failed to open stream: No such file or directory in /home/xxxx/public_html/xxxxxxx/xxx/fpdf.php on line 550

Warning: setfont(helveticab.php): failed to open stream: No such file or directory in /home/xxxx/public_html/xxxxxxx/xxx/fpdf.php on line 550

Warning: setfont(): Failed opening 'helveticab.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxx/public_html/xxxxxxx/xxx/fpdf.php on line 550
FPDF error: Could not include font metric file
  #5 (permalink)  
Antiguo 21/12/2005, 17:47
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Tema resuelto, se me olvido subir la carpeta "font".

¿como hago para imprimir campos de un registro determinado? estuve leyndo un ejemplo pero no me aclaro, gracias.
  #6 (permalink)  
Antiguo 22/12/2005, 04:25
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Hola Caricatos,
Bueno ya consegui pasar los datos de los diferentes campos para crear el pdf, pero soy incapaz de que me muestre una imagen, tengo en una varibale llamada $foto el nombre de archivo a mostrar y en el servidor fisicamente el archivo ¿como lo hago?

Tambien se me momtan el texto de los diferentes campos, ¿como coloco unos debajo de otros?

Gracias.
  #7 (permalink)  
Antiguo 22/12/2005, 08:31
Avatar de gonzalezmfrank  
Fecha de Ingreso: julio-2005
Ubicación: Maracaibo - Venezuela
Mensajes: 266
Antigüedad: 18 años, 9 meses
Puntos: 0
Revisa en la documentacion de FPDF....

Existe por ejemplo la sentencia Image cuya sentencia es así

Código PHP:
$pdf->Image($imagen,X Superior Izq,Y Superior Izq,X Inferior Der,Y Inferior Der); 
$imagen ... debe ser la imagen con su directorio ( en el caso de que no exista )... te recomiendo utilizar la direccion http completa ( algunos servidores no permites streaming por lo cual te recomiendo que utilices esto ultimo cuando lo pases a produccion solamente )

En la X Inferior Der y Y Inferior Derecha puedes colocar 0 y te ajusta la escritura de la imagen a la
dimension

Tienes que tener claro que soporta solo imagenes del tipo JPG,JPEG y PNG ( segun la documentacion )

Espero te sirva de algo

Saludos

Frank
  #8 (permalink)  
Antiguo 22/12/2005, 10:17
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Ya me toma todos los contenidos en sus respectivas varibales al final puse para imprimir la imagen en el pdf
$pdf->Image($fotofinal,0,0);

pero ahora me da otro tipo de error como el siguiente:

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/public_html/xxxx/creapdf.php:13) in /home/xxxx/public_html/xxxx/fpdf.php on line 1022
FPDF error: Some data has already been output to browser, can't send PDF file

¿que es ese erro?
  #9 (permalink)  
Antiguo 22/12/2005, 15:10
Avatar de gonzalezmfrank  
Fecha de Ingreso: julio-2005
Ubicación: Maracaibo - Venezuela
Mensajes: 266
Antigüedad: 18 años, 9 meses
Puntos: 0
De acuerdo

Incluye por favor tu codigo de creapdf.php

A mi me da el error en los casos de que la imagen no exista.. lo que hice es validar la existencia de la imagen con una funcion, y si no existe, trae por defecto una imagen en blanco.... no estoy en la oficina por el momento pero verifica eso... verifica que el valor de la imagen tenga asociada el directorio donde esta la imagen

Un saludo

Frank
  #10 (permalink)  
Antiguo 22/12/2005, 16:59
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Bueno al final resolvi el problema para que la foto salga

$foto=$_GET['foto'];
$fotofinal='../fotos/'.$foto;

...........
....

$pdf->Image($fotofinal,80,190);


lo que no tengo claro es como ubicar cada dato en una fila, creo que va con coordenadas x,y ¿alguien sabe?

gracias
  #11 (permalink)  
Antiguo 22/12/2005, 17:22
Avatar de caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Hola pereztroff:

No sé si lo que quieres se parece a lo que tengo en mi página, pero te paso el código:

Código:
<?php
require('../fpdf/fpdf.php');
require('rotation.php');
define('FPDF_FONTPATH','../fpdf/font/');

if (isset($_GET["foto"]))	{
	$foto = urldecode($_GET["foto"]);
}
else	{
	$foto = "../2002/fotos/2002V087.jpg";
}

if (isset($_GET["formato"]))	{
	$formato = $_GET["formato"];
}
else	{
	$formato = "V";
}

if (isset($_GET["pag"]))	{
	$pag = $_GET["pag"];
}
else	{
	$pag = "A4";
}

if ($pag == "A6")
	$a = array (105.0, 148.5);
else
	$a = $pag;

if ($formato == "H")
	$formatoPdf = ($pag == "A6" || $pag == "A4") ? "L" : "P";
else
	$formatoPdf = ($pag == "A6" || $pag == "A4") ? "P" : "L";

//class PDF extends FPDF	{
class PDF extends PDF_Rotate	{

	function RotatedText($x, $y, $txt, $angle)	{

		//Text rotated around its origin

		$this->Rotate($angle,$x,$y);
		$this->Text($x,$y,$txt);
		$this->Rotate(0);
	}


	function ponImagen($foto, $x, $y, $ancho, $alto, $tipo, $margen)	{
		$x0 = $x + $margen;
		$y0 = $y + $margen;
		$w0 = $ancho - ($margen * 2);
		$h0 = $alto - ($margen * 2);
		$this->Image($foto, $x0, $y0, $w0, $h0, $tipo);
	}

	function ponLineas($x, $y, $ancho, $alto, $margen, $foto)	{
		$this->SetFont('Arial', '', 8);
		$this->SetLineWidth(.1);


		// posición del texto
		$lineaL = array(5, 100);
		$lineaP = array(100, 143.5);
		$linea = array(true => $lineaL, false => $lineaP);
		list($x0, $y0) = $linea[$ancho > $alto];
		if ($ancho > $alto)
			$this->Text($x0 + $x, $y0 + $y, $foto);
		else
			$this->RotatedText($x0 + $x, $y0 + $y, $foto, 90);

		// Línea inferior alargada de la postal

		$lineaL = array(5, 95, 143.5, 95);
		$lineaP = array(95, 5, 95, 143.5);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Línea divisoria

		$lineaL = array(74, 5, 74, 90);
		$lineaP = array(5, 74, 90, 74);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Pequeña línea inferior derecha y baja de la postal

		$lineaL = array(90, 90, 143.5, 90);
		$lineaP = array(90, 5, 90, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Pequeña línea inferior (un poco hacia arriba) derecha y baja de la postal

		$lineaL = array(90, 80, 143.5, 80);
		$lineaP = array(80, 5, 80, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Otra pequeña línea inferior (un poco hacia arriba) derecha y baja de la postal

		$lineaL = array(90, 77, 143.5, 77);
		$lineaP = array(77, 5, 77, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 70, 143.5, 70);
		$lineaP = array(70, 5, 70, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Otra línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 60, 143.5, 60);
		$lineaP = array(60, 5, 60, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Primera línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 50, 143.5, 50);
		$lineaP = array(50, 5, 50, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Recuadro para el sello

		$lineaL = array(123.5, 5, 20, 25);
		$lineaP = array(5, 5, 25, 20);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Rect($x0 + $x, $y0 + $y, $x1, $y1, "");

	}

}

//$a = array (105.0, 148.5);
$pdf=new PDF($formatoPdf, 'mm', $a);
$pdf->AddPage();

switch ($pag)	{
	case "A6":
		if ($formatoPdf == "P")	{
			$pdf->ponImagen($foto, 0, 0, 105, 148.5, 'JPEG', 5);
		}
		else	{
			$pdf->ponImagen($foto, 0, 0, 148.5, 105, 'JPEG', 5);
		}
		break;
	case "A5":
		if ($formatoPdf == "L")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
		}
		break;
	case "A4":
		if ($formatoPdf == "P")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 5, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 153, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 110, 138, 95, 'JPEG');
		}
		break;
	case "A3":
		if ($formatoPdf == "L")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 5, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 215, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 320, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 215, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 320, 153, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 215, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 320, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 215, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 320, 138, 95, 'JPEG');
		}
		break;
}

$pdf->AddPage();

switch ($pag)	{
	case "A6":
		if ($formatoPdf == "P")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
		}
		break;
	case "A5":
		if ($formatoPdf == "L")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
		}
		break;
	case "A4":
		if ($formatoPdf == "P")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(0, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 148.5, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 105, 148.5, 105, 5, $foto);
		}
		break;
	case "A3":
		if ($formatoPdf == "L")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(0, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(210, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(315, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(210, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(315, 148.5, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 210, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 315, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 210, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 315, 148.5, 105, 5, $foto);
		}
		break;
}

$pdf->Output();
?>
La selección de parámetros se ve aquí: http://www.sucaricatura.com/imprimir...s/2002V087.jpg

Y el resultado: http://www.sucaricatura.com/fpdf/cre....jpg&formato=V

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo
  #12 (permalink)  
Antiguo 23/12/2005, 03:11
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Gracias Caricatos, revisare lo que me dices.
  #13 (permalink)  
Antiguo 22/01/2006, 11:23
Avatar de pereztroff  
Fecha de Ingreso: junio-2002
Ubicación: En la Internet.
Mensajes: 4.068
Antigüedad: 21 años, 10 meses
Puntos: 5
Cita:
Iniciado por caricatos
Hola pereztroff:

No sé si lo que quieres se parece a lo que tengo en mi página, pero te paso el código:

Código:
<?php
require('../fpdf/fpdf.php');
require('rotation.php');
define('FPDF_FONTPATH','../fpdf/font/');

if (isset($_GET["foto"]))	{
	$foto = urldecode($_GET["foto"]);
}
else	{
	$foto = "../2002/fotos/2002V087.jpg";
}

if (isset($_GET["formato"]))	{
	$formato = $_GET["formato"];
}
else	{
	$formato = "V";
}

if (isset($_GET["pag"]))	{
	$pag = $_GET["pag"];
}
else	{
	$pag = "A4";
}

if ($pag == "A6")
	$a = array (105.0, 148.5);
else
	$a = $pag;

if ($formato == "H")
	$formatoPdf = ($pag == "A6" || $pag == "A4") ? "L" : "P";
else
	$formatoPdf = ($pag == "A6" || $pag == "A4") ? "P" : "L";

//class PDF extends FPDF	{
class PDF extends PDF_Rotate	{

	function RotatedText($x, $y, $txt, $angle)	{

		//Text rotated around its origin

		$this->Rotate($angle,$x,$y);
		$this->Text($x,$y,$txt);
		$this->Rotate(0);
	}


	function ponImagen($foto, $x, $y, $ancho, $alto, $tipo, $margen)	{
		$x0 = $x + $margen;
		$y0 = $y + $margen;
		$w0 = $ancho - ($margen * 2);
		$h0 = $alto - ($margen * 2);
		$this->Image($foto, $x0, $y0, $w0, $h0, $tipo);
	}

	function ponLineas($x, $y, $ancho, $alto, $margen, $foto)	{
		$this->SetFont('Arial', '', 8);
		$this->SetLineWidth(.1);


		// posición del texto
		$lineaL = array(5, 100);
		$lineaP = array(100, 143.5);
		$linea = array(true => $lineaL, false => $lineaP);
		list($x0, $y0) = $linea[$ancho > $alto];
		if ($ancho > $alto)
			$this->Text($x0 + $x, $y0 + $y, $foto);
		else
			$this->RotatedText($x0 + $x, $y0 + $y, $foto, 90);

		// Línea inferior alargada de la postal

		$lineaL = array(5, 95, 143.5, 95);
		$lineaP = array(95, 5, 95, 143.5);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Línea divisoria

		$lineaL = array(74, 5, 74, 90);
		$lineaP = array(5, 74, 90, 74);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Pequeña línea inferior derecha y baja de la postal

		$lineaL = array(90, 90, 143.5, 90);
		$lineaP = array(90, 5, 90, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Pequeña línea inferior (un poco hacia arriba) derecha y baja de la postal

		$lineaL = array(90, 80, 143.5, 80);
		$lineaP = array(80, 5, 80, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Otra pequeña línea inferior (un poco hacia arriba) derecha y baja de la postal

		$lineaL = array(90, 77, 143.5, 77);
		$lineaP = array(77, 5, 77, 50);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 70, 143.5, 70);
		$lineaP = array(70, 5, 70, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Otra línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 60, 143.5, 60);
		$lineaP = array(60, 5, 60, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);


		// Primera línea mayor (un poco hacia arriba) derecha

		$lineaL = array(78, 50, 143.5, 50);
		$lineaP = array(50, 5, 50, 70);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Line($x0 + $x, $y0 + $y, $x1 + $x, $y1 + $y);

		// Recuadro para el sello

		$lineaL = array(123.5, 5, 20, 25);
		$lineaP = array(5, 5, 25, 20);
		$linea = array(true => $lineaL, false => $lineaP);

		list($x0, $y0, $x1, $y1) = $linea[$ancho > $alto];
		$this->Rect($x0 + $x, $y0 + $y, $x1, $y1, "");

	}

}

//$a = array (105.0, 148.5);
$pdf=new PDF($formatoPdf, 'mm', $a);
$pdf->AddPage();

switch ($pag)	{
	case "A6":
		if ($formatoPdf == "P")	{
			$pdf->ponImagen($foto, 0, 0, 105, 148.5, 'JPEG', 5);
		}
		else	{
			$pdf->ponImagen($foto, 0, 0, 148.5, 105, 'JPEG', 5);
		}
		break;
	case "A5":
		if ($formatoPdf == "L")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
		}
		break;
	case "A4":
		if ($formatoPdf == "P")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 5, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 153, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 110, 138, 95, 'JPEG');
		}
		break;
	case "A3":
		if ($formatoPdf == "L")	{
			$pdf->Image($foto, 5, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 5, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 110, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 215, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 320, 5, 95, 138, 'JPEG');
			$pdf->Image($foto, 215, 153, 95, 138, 'JPEG');
			$pdf->Image($foto, 320, 153, 95, 138, 'JPEG');
		}
		else	{
			$pdf->Image($foto, 5, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 5, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 110, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 215, 138, 95, 'JPEG');
			$pdf->Image($foto, 5, 320, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 215, 138, 95, 'JPEG');
			$pdf->Image($foto, 153, 320, 138, 95, 'JPEG');
		}
		break;
}

$pdf->AddPage();

switch ($pag)	{
	case "A6":
		if ($formatoPdf == "P")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
		}
		break;
	case "A5":
		if ($formatoPdf == "L")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
		}
		break;
	case "A4":
		if ($formatoPdf == "P")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(0, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 148.5, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 105, 148.5, 105, 5, $foto);
		}
		break;
	case "A3":
		if ($formatoPdf == "L")	{
			$pdf->ponLineas(0, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(0, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(105, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(210, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(315, 0, 105, 148.5, 5, $foto);
			$pdf->ponLineas(210, 148.5, 105, 148.5, 5, $foto);
			$pdf->ponLineas(315, 148.5, 105, 148.5, 5, $foto);
		}
		else	{
			$pdf->ponLineas(0, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 0, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 105, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 210, 148.5, 105, 5, $foto);
			$pdf->ponLineas(0, 315, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 210, 148.5, 105, 5, $foto);
			$pdf->ponLineas(148.5, 315, 148.5, 105, 5, $foto);
		}
		break;
}

$pdf->Output();
?>
La selección de parámetros se ve aquí: http://www.sucaricatura.com/imprimir...s/2002V087.jpg

Y el resultado: http://www.sucaricatura.com/fpdf/cre....jpg&formato=V

Saludos
Estuve probando pero las lineas se me montan unas encima de otras no se como hacerlo.

No se si comente antes que los datos que imprimo proviene de una base de datos.
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.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 02:23.