public function testProcessException() { $this->setExpectedException('Exception'); JasperPHP::process(); }
public function post() { $jasperPHP = new JasperPHP(); $database = \Config::get('database.connections.comments'); // $output = public_path() . '/report/journal'; // $ext = "pdf"; // // // $result = $jasperPHP->process(public_path() . "/report/journal.jasper", $output, array($ext), array("sucursal" => '%', "fecha_inicio" => "2014-01-01", 'fecha_fin' => "2014-12-12"), $database, false, false)->execute(); // dd($result); // // // header('Content-Description: File Transfer'); header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename=' . time() . 'journal.' . $ext); header('Content-Transfer-Encoding: binary'); //// header('Expires: 0'); //// header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); //// header('Pragma: public'); header('Content-Length: ' . filesize($output . '.' . $ext)); // header('Accept-Ranges: bytes'); flush(); readfile($output . '.' . $ext); unlink($output . '.' . $ext); // deletes the temporary file // // // // return Redirect::to('/reporting'); }
public function post() { $jasper = new JasperPHP(); $filename = time() . 'test'; $database = \Config::get('database.connections.mysql'); $output = public_path() . '/report/' . $filename; $jasper->process(public_path() . '/report/test.jasper', $output, array('pdf'), array(), $database)->execute(); sleep(2); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename . '.pdf'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($output . '.pdf')); flush(); readfile($output . '.pdf'); unlink($output . '.pdf'); // deletes the temporary file // return redirect()->route('s.subject.report'); }