<?php

namespace App\Libraries;

use Dompdf\Dompdf;

class PdfGenerator {
    public function generate($html, $filename, $paper = 'A4', $orientation = 'portrait') {
        $dompdf = new Dompdf();
        $dompdf->loadHtml($html);
        $dompdf->setPaper($paper, $orientation);
        $dompdf->render();
        $dompdf->stream($filename . ".pdf", ["Attachment" => true]);
    }
}