function html2pdf($html, $nombre = "archivo.pdf", $orientacion = "P", $tamanio = "A4", $tituloDocumento = '') { $colegioSessionBean = new ColegioSessionBean(); $fechaActual = obtenerFechaActualFull(); $html = str_replace("\\", "", $html); ob_start(); //include(dirname(__FILE__).'/res/exemple07a.php'); //include(dirname(__FILE__).'/res/exemple07b.php'); echo '<link rel="stylesheet" href="' . PATH_HTTP . 'css/tablas.css" type="text/css" />'; //$html = ereg_replace("\\", "XD", $html); echo '<table> <tr> <td align="center" width="1200"><strong>' . $colegioSessionBean->getNombre() . '</strong> <br/>' . $tituloDocumento . '</td> <td rowspan="2"><img alt="logo" title="logo" src="' . PATH_HTTP . 'images/' . $colegioSessionBean->getColegio_ID() . '/logo.jpg"></td> </tr> </table> <div style="width:1200px; align=right;font-size:8px;">Informe generado el ' . $fechaActual . '</div><br/>'; echo $html; $content = ob_get_clean(); // conversion HTML => PDF //require_once(dirname(__FILE__).'/../html2pdf.class.php'); $html2pdf = new HTML2PDF($orientacion, $tamanio, 'es'); $html2pdf->pdf->SetDisplayMode('fullpage'); //$html2pdf->pdf-> // $html2pdf->pdf->SetProtection(array('print'), 'spipu'); $html2pdf->WriteHTML($content, isset($_GET['vuehtml'])); //echo $content; $html2pdf->Output($nombre); }
<?php session_start(); require "../main_Lib.php"; include_once "../class/class_matricula.php"; include_once '../class/class_curso.php'; include_once '../class/class_alumno.php'; include_once '../bean/ColegioSessionBean.php'; require "../smartyLib/Smarty.class.php"; $smarty = new Smarty(); require_once '../phpLib/SmartyToolbox.php'; validarAcceso(AuthUser::TIPO_SECRETARIA); smartyTemplate($smarty, "../"); $matriculaSvc = new matricula(); $cursoSvc = new curso(); $colegioSesionBean = new ColegioSessionBean(); $alumnoSvc = new alumno(); $cursos = $cursoSvc->obtenerCursos(); $curso_ID = isset($_POST['curso_ID']) ? $_POST['curso_ID'] : $_SESSION['curso_ID']; if ($curso_ID != null) { // dpr($curso_ID); $alumnos = $alumnoSvc->obtenerAlumnos($curso_ID, 1, FALSE); foreach ($alumnos as $rut => $alumno) { $datos["FK_rut"] = $rut; $datos["FK_colegios_colegio_ID"] = $colegioSesionBean->getColegio_ID(); $datos["matric_anio"] = MATRICULA_ANIO; $matricula = $matriculaSvc->obtenerMatricula($datos); $alumnosMatric[$rut]["dato_alumno"] = $alumno["dato_alumno"]; $alumnosMatric[$rut]["matricula"] = $matricula; } //$datos['FK_rut'] =