debug=true; $mpdf->tabSpaces = 6; $mpdf->allow_charset_conversion=true; $mpdf->charset_in='windows-1252'; //============================================================== preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$filename,$m); $num = intval($m[1]); $title = ucfirst(preg_replace('/_/',' ',$m[2])); if (!$num || !$title) { die("Invalid file"); } if (preg_match('/\//', $filename) || !preg_match('/\.php$/',$filename)) { die("Hacking attempt"); } $html = '

mPDF

Example '.$num.'. '.$title.'

'; $lines = file($filename); $html .= '
';
foreach($lines AS $line) {
	$html .= htmlspecialchars($line);
}
$html .= '
'; $html .= '
'; $mpdf->WriteHTML($html,2); // The 2 is important to prevent