error en descarga pdf
Publicado por VICTOR AUGUSTO (9 intervenciones) el 19/06/2018 18:04:55
hola gracias por sus consejos pero tengo este problema cuando exporto el archivo lo descarga pero al abrirlo me sale que el archivo esta dañado y que hubo un error en la descarga este mi codigo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
require_once("dompdf/dompdf_config.inc.php");
$conexion=mysqli_connect('localhost', 'root', '', 'usuarios');
$codigoHTML.='
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>REPORTE</title>
</head>
<body>
<h1>REPORTE</h1>
<table cellpadding="12px" cellspacing="0px" border="1" align="center" >
<tr>
<td align="center" bgcolor="#1D90EB" width="33.33%">id</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Nombre</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Apellido</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Correo</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Usuario</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Password</td>
<td align="center" bgcolor="#1D90EB" width="33.33%">Tipo de Usuario</td>
</tr>';
$sql="SELECT * FROM usuarios_bd";
$result=mysqli_query($conexion,$sql);
while($mostrar=mysqli_fetch_array($result)){
$codigoHTML.='
<tr>
<td>'.$mostrar['id'].'</td>
<td>'.$mostrar['Nombre'].'</td>
<td>'.$mostrar['Apellido'].'</td>
<td>'.$mostrar['Correo'].'</td>
<td>'.$mostrar['Usuario'].'</td>
<td>'.$mostrar['Password'].'</td>
<td>'.$mostrar['Tipo'].'</td>
</tr>';
}
$codigoHTML='
</table>
</body>
</html>';
$codigoHTML=utf8_encode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","128M");
$dompdf->set_paper('A4', 'landscape');
$dompdf->render();
$dompdf->stream("Reporte_1.pdf");
Valora esta pregunta


0