<?php
error_reporting(0);
ini_set('memory_limit', '1G');
require_once("dompdf/autoload.inc.php");

use Dompdf\Dompdf;

$dompdf = new Dompdf();

ob_start();

if (isset($_GET['p'])) {
	if ($_GET['p'] == 'cover') {
		include_once 'cover.php';
	} else 
	if ($_GET['p'] == 'rapor1') {
		include_once 'rapor1.php';
	} else 
	if ($_GET['p'] == 'rapor2') {
		include_once 'rapor2.php';
	} else 
	if ($_GET['p'] == 'raporp5') {
		include_once 'raporp5.php';
	}
}

$html = ob_get_clean();

$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();

// Output the PDF
$dompdf->stream($filename . '.pdf', ['Attachment' => 0]);
