Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2015, 19:01
yisu07
 
Fecha de Ingreso: febrero-2015
Mensajes: 2
Antigüedad: 10 años
Puntos: 0
Pregunta Problema con MPDF, me genera PDF en blanco!!

Tengo un problema con el mpdf, estoy usando el codigo a continuacion para generar varias paginas en un mismo archivo pdf, dependiendo la cantidad y los datos dentro de las mismas de for usado para llamar los datos del array "id_cliente". El problema es que me sigue generando paginas en blanco y de verdad ya no tengo idea de que pueda ser, ya he revisado el codigo varias veces de arriba a abajo y no le veo problemas, agradeceria mucho la ayuda de alguien de aqui del foro :).

Codigo:

<?php
require_once('Connections/gestion_barrio_adentro.php');
header('Content-Type: text/html; charset=UTF-8');
include('mpdf/mpdf.php');
$mpdf=new mPDF('utf-8', 'Letter');

if(isset($_POST['id_cliente'])){
$fecha_nota=$_POST['fecha_nota'];
$id_periodo=$_POST['id_periodo'];
$id_cliente=$_POST['id_cliente'];

$date = date_create($fecha_nota);
$mes=date_format($date, 'm');

if ($mes=="01"){
$fecha_completa=date_format($date, 'd')." DE ENERO DE ".date_format($date, 'Y');
}
if ($mes=="02"){
$fecha_completa=date_format($date, 'd')." DE FEBRERO DE ".date_format($date, 'Y');
}
if ($mes=="03"){
$fecha_completa=date_format($date, 'd')." DE MARZO DE ".date_format($date, 'Y');
}
if ($mes=="04"){
$fecha_completa=date_format($date, 'd')." DE ABRIL DE ".date_format($date, 'Y');
}
if ($mes=="05"){
$fecha_completa=date_format($date, 'd')." DE MAYO DE ".date_format($date, 'Y');
}
if ($mes=="06"){
$fecha_completa=date_format($date, 'd')." DE JUNIO DE ".date_format($date, 'Y');
}
if ($mes=="07"){
$fecha_completa=date_format($date, 'd')." DE JULIO DE ".date_format($date, 'Y');
}
if ($mes=="08"){
$fecha_completa=date_format($date, 'd')." DE AGOSTO DE ".date_format($date, 'Y');
}
if ($mes=="09"){
$fecha_completa=date_format($date, 'd')." DE SEPTIEMBRE DE ".date_format($date, 'Y');
}
if ($mes=="10"){
$fecha_completa=date_format($date, 'd')." DE OCTUBRE DE ".date_format($date, 'Y');
}
if ($mes=="11"){
$fecha_completa=date_format($date, 'd')." DE NOVIEMBRE DE ".date_format($date, 'Y');
}
if ($mes=="12"){
$fecha_completa=date_format($date, 'd')." DE DICIEMBRE DE ".date_format($date, 'Y');
}

for ($i=0;$i<count($id_cliente);$i++)
{
$cant=0;
$sql="SELECT *FROM cliente where id_cliente='$id_cliente[$i]';";
$resultado=mysql_query($sql) or die("Se encontro un problema");
$resul1=mysql_fetch_array($resultado);

$tipo_cliente=$resul1['tipo_cliente'];



$sql2="SELECT *FROM consulta_productos where id_periodo='$id_periodo' and tipo_cliente='$tipo_cliente';";
$resultado2=mysql_query($sql2) or die("Se encontro un problema");





$html1 = '

<html>
<head>
<meta charset="utf-8">
<title>Nota de Entrega</title>

<body>

<div align="center">
<BR><BR><BR><BR><BR><BR>


<div>
<table width="750" border="0" style="font-size:16">
<tr>
<td colspan="2" align="left">


<BR>

<strong>FECHA:</strong> '.$fecha_completa.'
<BR>
<strong>CLIENTE:</strong> FUNDACION MISION BARRIO ADENTRO. ADMINISTRACION ZULIA.

<BR>
<strong>RIF:</strong> G-20006816-7.
<BR>
<strong>DIRECCION:</strong>
'.$resul1['nombre_cliente'].'

<BR><BR>
';



$html2 = '

<table bordercolor="#000000" width="750" border="1" align="left" style="border-collapse:collapse; font-size:16">
<tr>
<th> N° </th> <th> DESCRIPCIÓN DEL PRODUCTO </th> <th> U/M </th> <th> CANTIDAD </th> <th> PRECIO </th> <th> TOTAL </th>
</tr>
';

while($resul12=mysql_fetch_array($resultado2)){
$cant=$cant+1;
$html3 .= '
<table width="750" border="0" style="font-size:16">

<tr>
<td width="50" align="center" valign="middle"> '.$cant.'</td>
<td width="50" align="center" valign="middle">'.$resul12["cantidad_producto"].'</td>
<td width="100" align="center" valign="middle">'.$resul12["um_producto"].'</td>
<td align="center" valign="middle">'.$resul12["nombre_producto"].'</td>
</tr>

';

}







$html5 = '
</table>




</div>
<div id="footer" align="center">

</div></div>


</body>
</html>

';


$mpdf->AddPage();
$mpdf->WriteHTML($html1);
$mpdf->WriteHTML($html2);
$mpdf->WriteHTML($html3);
$mpdf->WriteHTML($html5);




}


}
$mpdf->Output('documentos/notas de entrega/'.$fecha_nota.'.pdf', 'F');
?>