File: //proc/thread-self/cwd/emu-personality-test/pdf.php
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$test = $_REQUEST['test'];
require_once '/var/www/selfanalyse/dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
if ($test != '' && is_numeric($test) && strlen($test) <= 5) {
$file = "/var/www/selfanalyse/emu-personality-test/pdf-html/pdf-" . $test . ".html";
$html = file_get_contents($file);
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF (1 = download and 0 = preview)
$dompdf->add_info('Title', 'EMU Personality Test | Downlaod Report - ThinkEmu');
$dompdf->stream("EMU Personality Test Report", array("Attachment" => 0));
}