Aver si te puedo ayudar con lo que tengo yo:
Tengo un php que me pregunta que numero de id quiero imprimir para tomar los datos de la base:
Código PHP:
#ESTE ES EL ARCHIVO QUE TE CONSULTA QUE QUERES IMPRIMIR.
<?php
include ("conexion.php");
$rst_ordenes= mysql_query("SELECT * FROM nueo WHERE or=".$_REQUEST["cod"].";",$conexion);
$fila_orden= mysql_fetch_array($rst_ordenes);
?>
<html>
<body>
<form action="imprimir_orden.php?cod=<?php echo $_REQUEST["or"] ?>" method="post">
<table style="width: 100; text-align: center; margin-left: auto; margin-right: auto; height: 100px;" border="1" cellpadding="0" cellspacing="0">
<th align="center" style="width: 100%" class="style5">SE VA A IMPRIMIR</th>
<tr>
<td align="center" width="200">
LA ORDEN N°:</br>
</tr>
<tr>
<td>
<span align="center" >
<input text-align="center" type="text" name="or" maxlength="20" value="<?php echo $fila_orden;?>"/>
</span></td>
<tr>
<td align="center">
<input value="OK" type="submit"></td>
</tr></table>
</body>
</html>
Código PHP:
# ESTE ES EL PHP QUE CREA EL PDF Y TE DA LA OPCION DE GUARDARLO ENEL HDD O SINO IMPRIMIRLO, SEGUN SI LO GUARAS O LO ABRIS.
<?php
require_once('class.ezpdf.php');
$pdf =& new Cezpdf('a4');
$pdf->selectFont('fonts/courier.afm');
$pdf->ezSetCmMargins(0,0,1,1);
$pdf->ezText('',12);
include ("conexion.php");
$rst_ordenes = "SELECT * FROM nuo WHERE or=".$_REQUEST["or"].";";
$fila_orden = mysql_query($rst_ordenes,$conexion) or die(mysql_error());
$totEmp = mysql_num_rows($fila_orden);
while($datatmp = mysql_fetch_assoc($fila_orden)) {
$data[] = array_merge($datatmp);
}
$titles = array ('or'=>'<b>N de orden:</b>',' '=>'
$options = array(
'shadeCol'=>array(0,0,0),
'xOrientation'=>'center',
'width'=>530
);
$txttit1 = "<b>FORMULARIO</b>";
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titles,', $options);
$pdf->ezStream();
?>
Fijate si te sirve, no se si lo pase todo bien. saludos y suerte