getOutputMode() === 'pdf'); } /** * Return the download filename. This should be the "clean" name, not * a munged temporary filename. * * @return string */ public function getFileName():string { return 'CiviReport.pdf'; } /** * Return the html body of the email. * * @return string */ public function getMailBody():string { // @todo It would be nice if this was more end-user configurable, but // keeping it the same as it was before for now. $url = CRM_Utils_System::url('civicrm/report/instance/' . $this->getForm()->getID(), 'reset=1', TRUE); return $this->getForm()->getReportHeader() . '
' . ts('Report URL') . ": {$url}
" . '' . ts('The report is attached as a PDF file.') . '
' . $this->getForm()->getReportFooter(); } /** * Return the report contents as a string, in this case the pdf file. * * @return string */ public function getOutputString():string { return CRM_Utils_PDF_Utils::html2pdf( $this->getForm()->compileContent(), $this->getFileName(), TRUE, ['orientation' => 'landscape'] ); } /** * Set headers as appropriate and send the output to the browser. */ public function download() { // Nb. Once upon a time we used a package called Open Flash Charts to // draw charts, and we had a feature whereby a browser could send the // server a PNG version of the chart, which could then be included in a // PDF by including