<?php session_start();?>
<?php
include('../_cfg/config.php');
include('php_gene1.php'); 
include('php_session.php');
//include('excel_reader2.php');
//include('vrreadxls.php');
// include('simplexlsx.class.php');

// echo date('H:i:s',strtotime('now'));

$modu$_POST['modu']; 


if($desti==''){$desti='screen';}

?>

<?php

// if($idnum!='')
// {
// 	$result=prnt_docu0($docu,$idnum,$forma,$desti);
// }


// html2pdf('')

ob_start();
echo $result;
$obstart = ob_get_clean(); 
if(!mb_stristr('pos.txt',$desti))
{$obstart = alltrim($obstart);}


// $_SESSION['user_vcrx_id']
// if($user_codigo=='')
// if($user_codigo=='' and $clave=='')
if($user_codigo=='' and $clave=='' and $_SESSION['user_vcrx_id']=='')
{
	if(!mb_stristr($obstart,$numero)){$obstart='Datos INCORRECTOS';}
	if(!mb_stristr($obstart,$enti)){$obstart='Datos INCORRECTOS';}
}

if(($user_tipo=='' or mb_stristr('invi.clie.prov.exte',$user_tipo))  and $clave=='')
{
	// debe coincidir la cedula del usuario con la entidad del docu
}

if($exte=='html')
{echo $obstart;}

if($exte=='pdf')
{
	
// 	$docuhtml='http://vcrxol.com/_cel/'.$clave.'.html';
	$docuhtml='http://'.$cfg_empr.'.vcrxol.com/_doc/'.$docu.'_'.fillzero($idnum).'.html';
// 	echo $docuhtml;
	$api_endpoint = "https://selectpdf.com/api2/convert/";
	$key='a08354d5-92b4-4a2b-a1a4-ab82c90a5c78';
// 	$parameters = array ('key' => $key, 'html' => $obstart, 'page_size' => 'A4');
	$parameters = array ('key' => $key, 'url' => $docuhtml, 'page_size' => 'A4');
	$result = file_get_contents("$api_endpoint?" . http_build_query($parameters));
	echo 'header("Content-Type: application/pdf");';
	echo 'header("Content-Disposition: attachment; filename=\"test.pdf\"");';
// 	echo 'PDF';
	echo $result;	
}
// echo $exte;
// echo date('H:i:s',strtotime('now'));

?>
	
	
				
				
				