<?php
	
ini_set('memory_limit','128M');
ini_set('max_execution_time', 300);
	date_default_timezone_set("Europe/Ljubljana");
	include("functions.php");
	ob_start();
	if(isset($_REQUEST['id'])){
		$id=$_REQUEST['id'];
		$_SESSION['id_naloga'] = $id;
		include("nalogtopdf.php");
	}
	else if(isset($_REQUEST['ser'])){
		$ser=$_REQUEST['ser'];
		$_SESSION['serija'] = $ser;
		include("rekapitulacija.php");
	}
	else{
		$id=1;
		$_SESSION['id_naloga'] = $id;
		include("nalogtopdf.php");
	}
	
		
	//include(dirname(__FILE__).'/rekapitulacija.php');
    $content = ob_get_clean();

    // convert to PDF
    require_once('../pdf/html2pdf.class.php');
    try
    {
        $html2pdf = new HTML2PDF('P', 'A4', 'fr');
        $html2pdf->pdf->SetDisplayMode('fullpage');
		$html2pdf->setDefaultFont('dejavusans'); 
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
		 ob_end_clean();
        $html2pdf->Output('test.pdf');
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
?>