How to use pdf in custom files? (v2022)

The following code is not working:$html = “

WELCOME TO PHP Dompdf

”;use Dompdf\Dompdf;ob_get_clean(); // Clear Buffer - this is very important!!!$document = new Dompdf();
$document->loadHtml($html);
//$document->setPaper(‘A4’, ‘portrait’);
$document->setPaper(“A4”, “$orientation”);
$document->render();
$document->stream(“Payslips”, array(“Attachment”=>0));

In general, Custom Files ares used to add your own pages to your site, not to output files. If you just want to output files, you better use route actions, see https://discourse.hkvstore.com/t/using-route-action-server-event-v2021/3393/1