<?php
session_start();
include "constantes.php";
//include "verifica.php";

//$parametro = $_REQUEST['parametro'];
?>
<?php //Ejemplo aprenderaprogramar.com
//$texto = file_get_contents("http://127.0.0.1/comercial2multiempresa_credito/aplantilla.php");
//$texto = file_get_contents("http://127.0.0.1/comercial2multiempresa_credito/ventas_formato.php?id=".$parametro);

$parametro = $_REQUEST['parametro'];

$options = array(
        'http'=>array(
                'method'=>"GET",
                'header'=>"Accept-language: en\r\n" .
                "Cookie: foo=bar\r\n" .  // check function.stream-context-create on php.net
                "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefox/20.0"
        )
);
 
$context = stream_context_create($options);
//$codiFont = file_get_contents("http://".$url, false, $context);

$texto = file_get_contents(RUTA."cotizacion_formato.php?id=".$parametro, false, $context);

//echo $texto;
$html = $texto;
//$html = mb_convert_encoding($html, 'UTF-8', 'UTF-8'); 
$html = utf8_encode($html);

//echo $html;

//$mpdf->WriteHTML(utf8_encode($html)); 

include("mpdf/mpdf.php");

$mpdf=new mPDF('c','A4','','',32,25,27,25,16,13); 

$mpdf->SetDisplayMode('fullpage');

$mpdf->list_indent_first_level = 0;	// 1 or 0 - whether to indent the first level of a list


// LOAD a stylesheet
//$stylesheet = file_get_contents('mpdfstyletables.css');
$stylesheet = file_get_contents('assets/css/pdf_formatos_cotizaciones.css');
$mpdf->WriteHTML($stylesheet,1);	// The parameter 1 tells that this is css/style only and no body/html/text

$mpdf->WriteHTML($html,2);

$mpdf->Output('mpdf.pdf','I');
exit;

?>