public function download($filename) {
    if(!empty($this->pdf->getError())) {
      throw new Exception('Could not create PDF: ' . $this->pdf->getError());
    } else {
      $filename = rtrim(File::create()->setName($filename), '.pdf') . '.pdf';
      $this->pdf->send($filename);
    }
  }