<?php

/**

 * HTML2PDF Librairy - example

 *

 * HTML => PDF convertor

 * distributed under the LGPL License

 *

 * @author      Laurent MINGUET <webmaster@html2pdf.fr>

 *

 * isset($_GET['vuehtml']) is not mandatory

 * it allow to display the result in the HTML format

 */



    // get the HTML

    ob_start();

	

	if(isset($_GET['submit']))

	{

	

	$id=$_GET['id'];

	$file=$_GET['file'];

	$date=$_GET['date'];

	$fromdate=$_GET['fromdate'];

	$todate=$_GET['todate'];

	$month=$_GET['month'];

	$year=$_GET['year'];

	$sitename=$_GET['sitename'];

	$supplier=$_GET['supplier'];

	$from=$_GET['from'];

	$to=$_GET['to'];

	$groupname=$_GET['groupname'];

	

	//$content=$date;

	

	/*echo'<input type="hidden" name="date" value="'.$date.'" /><input type="hidden" name="fromdate" value="'.$fromdate.'" /><input type="hidden" name="sitename" value="'.$sitename.'" />

	<input type="hidden" name="todate" value="'.$todate.'" /><input type="hidden" name="month" value="'.$month.'" /><input type="hidden" name="year" value="'.$year.'" />

	<input type="hidden" name="from" value="'.$from.'" /><input type="hidden" name="to" value="'.$to.'" /><input type="hidden" name="supplier" value="'.$supplier.'" />

	<input type="hidden" name="groupname" value="'.$groupname.'" />';

	*/

	

    include(dirname(__FILE__).'/'.$file.'');

    $content = ob_get_clean();



    // convert in PDF

    require_once(dirname(__FILE__).'/html2pdf.class.php');

    try

    {

        $html2pdf = new HTML2PDF('P', 'A4', 'fr');

//      $html2pdf->setModeDebug();

        $html2pdf->setDefaultFont('Arial');

        $html2pdf->writeHTML($content, isset($_GET['vuehtml']));

        $html2pdf->Output('invoice.pdf');

    }

    catch(HTML2PDF_exception $e) {

        echo $e;

        exit;

    }

	

	}

