This question already has answers here:
Closed 4 years ago.
ob_start();
require_once '\dompdf\autoload.inc.php';
use Dompdf\Dompdf;
//use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new DOMPDF();
$html = "
print_r($_POST);
";
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
$pdf = $dompdf->output();
file_put_contents("page.pdf", $pdf);
?>
<a href="./page.pdf" download="page.pdf">Download the pdf</a>
<?php
exit;
?>
I try to do downloadable PDF script but getting parse error.