<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once("./application/third_party/dompdf/autoload.inc.php");
use Dompdf\Dompdf;
class Pdfgenerator {
  public function generate($html, $filename='', $stream=TRUE, $paper = '', $orientation = '')
  {
    $dompdf = new DOMPDF();
    $dompdf->loadHtml($html);
    $dompdf->setPaper($paper, $orientation);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf", array("Attachment" => 0));
    } else {
        return $dompdf->output();
    }
  }
}