public function export() { $export = $_GET['export']; $self = new ReportController; $self->export = $export; if($export === 'xls') { $self->generate_report(false); $self->generate_xls(); exit; } else if($export === 'pdf') { include( plugin_dir_path ( __FILE__ ) . implode(DIRECTORY_SEPARATOR, array('..', 'lib', 'MPDF57', 'mpdf.php')) ); ob_start(); $self->generate_report(); $html = ob_get_contents(); ob_end_clean(); $mpdf=new \mPDF(); $mpdf->useOnlyCoreFonts = true; $mpdf->WriteHTML($html); $mpdf->Output(); exit; } else if($export === 'print') { $self->generate_report(); exit; } }