«
»

2014, php, php5

Visualizar al vuelo pdf con php DOMPDF

07.09.14 | Comment?

Alberto Suárez Pérez
public function pdf() {
$strHTML = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><HTML xmlns='http://www.w3.org/1999/xhtml' xml:lang='es'>";
$strHTML = $strHTML . "<HEAD><TITLE>HTMLtoPDFinPHP</TITLE><meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>";

foreach ($productos = $conten -> Getproduct($parametros) as $producto){

$strHTML = $strHTML . "<div class="."diventer".">".$i." - ".$producto["idVehiculo"]."</div>";
$strHTML = $strHTML ."<div class="."diventer".">".$producto["Nombre"]." "."</div>";

}

$strHTML = $strHTML .'<div class="divend">';
$strHTML = $strHTML .'<div class="diventer">sdfsdf</div>';
$strHTML = $strHTML .'<div class="diventer">sdfsdf</div>';
$strHTML = $strHTML . '<div class="diventer">sdfsdf</div>';

$strHTML = $strHTML .'</div>';

$strHTML = $strHTML .'<div class="divend">';
$strHTML = $strHTML .'<div class="diventer">sdfsdf</div>';
$strHTML = $strHTML .'<div class="diventer">sdfsdf</div>';
$strHTML = $strHTML . '<div class="diventer">sdfsdf</div>';

$strHTML = $strHTML .'</div>';
echo $strHTML;

$dompdf = new DOMPDF();
$dompdf->load_html(utf8_decode($strHTML));
$dompdf->render();      
$dompdf->stream("descargar_mi_pdf.pdf", array("Attachment" => false));
exit(0);






}

WEBMASTER | TENERIFE



<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:

:


«
»