Sie sind auf Seite 1von 3

DOCUMENTO PARA HACER EL LLAMADO DE LA LIBRERIA HTML2PDF

Y GENERAR EL DOCUMENTO EN FORMATO PDF


<?php
$fecha_inicio=$_GET['fecha_inicio'];
$fecha_final=$_GET['fecha_final'];
$usuario=$_GET['usuario'];
//incluyo la libreria html2pdf
include('../html2pdf/html2pdf.class.php');
ob_start();
//aqui llamo mi archivo que quiero que se genere
include('generarHistorial.php');
$content = ob_get_clean();
try
{
$html2pdf = new HTML2PDF('P','CARTA','es', true, 'UTF-8', array(9, 9, 9, 9));
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('Historial.pdf');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
?>

DOCUMENTO CON EL FORMATO QUE QUIERO QUE SE GENERE EN PDF


generarHistorial.php
<?php
echo $usuario=$_GET['usuario'];
echo $fecha_inicio=$_GET['fecha_inicio'];
echo $fecha_final=$_GET['fecha_final'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Museo Carupano</title>
<meta charset="utf-8" />
<style>
.barra1,.barra2,.barra3,.barra4{
border-radius:8px;
margin-left:5px;
position:relative;
float:left;
width:50px;
}
.barra1{
background: -webkit-linear-gradient(top, #ff3019 0%,#cf0404 100%);
}
.barra2{
background: -webkit-linear-gradient(top, #30ff19 0%,#04cf04 100%);
}
.barra3{
background: -webkit-linear-gradient(top, #3019ff 0%,#0404cf 100%);
}
.barra4{
background: -webkit-linear-gradient(top, #f73019 0%,#c70404 100%);
}
b{
margin:0;
margin-left:10px;
}
</style>
</head>
<body>
<?php
$hora = getdate(time());
$p=$hora["hours"] . ":" . $hora["minutes"] . ":" . $hora["seconds"];
?>

<div align="center" style="font-weight: bold; font-size: 10pt; color: black; ">


<img src="../images/logo2.png" >
</div><br>
<br><br><br><br />
<div align="center"><h4> HISTORIAL DEL <?php echo $usuario;?><br/>DESDE <?php echo
$fecha_inicio; ?> HASTA <?php echo $fecha_final;?> </h4></div><br /><br />
<b>Fecha:</b><?php echo $fechass=date('Y/m/d');?> <b>Hora:</b><?php $horas=$p; echo $horas;?
><br /><br /><br />
<?php
include("../models/bitacora.php");
$tra=new Usuario_bitacora();
$ejecucion=$tra->buscarBitacora($fecha_inicio,$fecha_final,$usuario);
?>
<table id="table" border="1" align="center" >
<tr align="center" style="background-color:#B41100 ; color:white; text-shadow:0 0 2px; fontsize:14px;">
<th>CODIGO</th>
<th>DESCRIPCIN</th>
<th>USUARIO</th>
<th>FECHA DE ACCESO</th>
<th>HORA DE ACCESO</th>
<th >IP</th>
</tr>
<?php
for($i=0;$i<sizeof($ejecucion);$i++){
$descripcion=$ejecucion[$i]['descripcion'];
?>
<tr >
<td><?php echo $i;?></td>
<td valign="top" align="center"><?php echo $ejecucion[$i]['descripcion'];?></td>
<td valign="top" align="center" ><?php echo $ejecucion[$i]['usuario'];?></td>
<td valign="top" align="center" ><?php echo $ejecucion[$i]['fecha'];?></td>
<td valign="top" align="center" ><?php echo $ejecucion[$i]['hora'];?></td>
<td valign="top" align="center" ><?php echo $ejecucion[$i]['tuip'];?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>

Das könnte Ihnen auch gefallen