<?php

defined ( '_JEXEC' ) or die ( 'Restricted access' );
/*
 * @component Calc Builder 
 * @copyright Copyright (C) January 2017. 
 * @license GPL 3.0 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details. 
 * See <http://www.gnu.org/licenses/>. 
 * More info www.moonsoft.es 
 * gestion@moonsoft.es
 */
// $stylesheet = file_get_contents(JURI::base().'modules/mod_calcbuilder/assets/css/'.MSHelper::__requestGetVarWrapper('style'));
$ret = '<html>';
$ret = '<body>';
/*
 * $ret.=$this->calculo['solution']->precalcprint; $ret.='<br /><br /><div class="cb_result">'; $ret.=$this->calculo['code']; $ret.='</div><br /><br />'; $ret.=$this->calculo['solution']->poscalcprint;
 */
$ret .= $this->calculo ['external_content'];
$ret .= '</body></html>';
// $mpdf=new mPDF();
$mpdf;
if ($this->calculo ['solution']->pdf_orientation)
	$mpdf = new mPDF ( '', 'A4-L' );
else
	$mpdf = new mPDF ( '', 'A4' );
	// $mpdf->SetProtection(array('copy','print'));
if ($this->calculo ['solution']->import_bootstrap) :
	$stylesheet = file_get_contents ( JURI::base () . 'modules/mod_calcbuilder/assets/css/bootstrap-responsive.min.css' );
	// $stylesheet = file_get_contents(JURI::base().'modules/mod_calcbuilder/assets/css/bootstrap.min_pdf.css');
	$mpdf->WriteHTML ( $stylesheet, 1 ); // The parameter 1 tells that this is css/style only and no body/html/text
	$stylesheet = file_get_contents ( JURI::base () . 'modules/mod_calcbuilder/assets/css/bootstrap.min.css' );
	$mpdf->WriteHTML ( $stylesheet, 1 ); // The parameter 1 tells that this is css/style only and no body/html/text
	$stylesheet = file_get_contents ( JURI::base () . 'modules/mod_calcbuilder/assets/css/cbbootstrap.css' );
	$mpdf->WriteHTML ( $stylesheet, 1 ); // The parameter 1 tells that this is css/style only and no body/html/text
	$stylesheet = file_get_contents ( JURI::base () . 'modules/mod_calcbuilder/assets/css/default.css' );
	$mpdf->WriteHTML ( $stylesheet, 1 );
	// The parameter 1 tells that this is css/style only and no body/html/text
endif;
// $ret = iconv("UTF-8","UTF-8//IGNORE",$ret);
$mpdf->WriteHTML ( $ret );
$mpdf->Output ('calcbuilder.pdf','I');