<?php
    require_once(BASEPATH.'assets/pdf/Html2Pdf/html2pdf-4.4.0/html2pdf.class.php');

    ob_start();
	include BASEPATH.'form/'.$this->modul.'/'.$this->view;
    $content = ob_get_clean();

    try
    {
		$file = BASEPATH.'pdf/'.$this->data->file.'.pdf';

		if(empty($this->data->paper)){
			$this->data->paper = 'P';
		}
		
		if(empty($this->data->size)){
			//----Uku F4
			$this->data->size = array(215.9, 330.2);
		}
		
        $html2pdf = new HTML2PDF($this->data->paper, $this->data->size, 'fr', true, 'UTF-8', array(0, 0, 0, 15));
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
        $html2pdf->Output($file, 'F');
		header("Content-type:application/pdf");
		echo file_get_contents($file);		
    }
    catch(HTML2PDF_exception $e) {
        echo $e;
        exit;
    }
