public function __construct(Report $report) { parent::__construct($report); $this->pdf = new \WKPDF(WKPDF_PATH); if (USE_XVFB) { $this->pdf->setXVFB(XVFB_PATH); } $this->pdf->set_orientation('Landscape'); }
/** * Constructor * * @param Report $report The report instance we're working with. * @param ReportHtmlView $htmlView The ReportHtmlView to convert. */ public function __construct(Report $report, ReportHtmlView $htmlView) { parent::__construct($report); $this->htmlView = $htmlView; $this->pdf = new \WKPDF(WKPDF_PATH); if (USE_XVFB) { $this->pdf->setXVFB(XVFB_PATH); } }
/** * Default implementation for the iPdfReportView interface. Responsible * for appending a file extention to the file name, getting the output * from the provided view, saving that output to a file, and storing the * finished file name in the Report object. * * Can be overrriden if custom behavior is necessary. * * @see iHtmlReportView * @param ReportPdfView $pdfView */ public function savePdfOutput(ReportPdfView $pdfView) { // Add the proper extension $fileName = $this->fileName . '.pdf'; $pdfView->render(); $fileResult = file_put_contents($fileName, $pdfView->getPdfContent()); // Save the file name to the report $this->report->setPdfOutputFilename($fileName); $this->report->save(); }