示例#1
0
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);
}