<?
	#include('html2pdf/htmltoolkit.php');
	#include('html2pdf/fpdf.php');
	#include('html2pdf/gif.php');
	include('html2pdf/html2fpdf.php');
	#include('html2pdf/source2doc.php');
	
	$file = $_REQUEST['filename'];
	
	if (! preg_match("/^invoicepdf_/", $file) && ! preg_match("/^brandpdf_/", $file))
		die('invalid file');
	
	$html = implode('', file($file));
	
	$pdf = new HTML2FPDF();
	$pdf->AddPage();
	$pdf->UseCSS(true);
	$pdf->WriteHTML($html);
	$pdf->Output();
	
	unlink($file);
?>