templating = $templating; } public function render($filename, $view, $viewParams) { $pdfOptions = new Options(); $pdfOptions->set('defaultFont', 'Arial'); $dompdf = new Dompdf($pdfOptions); $html = $this->templating->render($view, $viewParams); $dompdf->loadHtml($html); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $dompdf->stream($filename, [ "Attachment" => true ]); } }