我有一个Laravel项目,我想使用该库创建一些报告:
https://github.com/lavela/phpjasper
我已正确安装所有组件,但收到错误消息。
这是我得到的错误:
用法:jasperstarter进程[-h] -f [...] [-o] [-w]
这是我生成报告的方法:
public function generateReport(Request $request) {
$input = base_path() . '/reports/assembler_commission_por_montador.jrxml';
$output = base_path() . '/reports/' . time() . '_montadores';
// $jdbc_dir = base_path() . '/vendor/lavela/phpjasper/bin/jaspertarter/jdbc';
$jdbc_dir = 'C:\xampp\htdocs\manager_api\local\vendor\lavela\phpjasper\bin\jasperstarter\jdbc';
$options = [
'format' => ['pdf'],
'locale' => 'pt-BR',
'params' => [],
'db_connection' => [
'driver' => env('DB_CONNECTION'), //mysql, ....
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'),
'port' => env('DB_PORT'),
'jdbc_driver' => 'org.postgresql.Driver',
'jdbc_url' => 'jdbc:postgresql://myip/db_wtask',
'jdbc_dir' => $jdbc_dir
],
];
$jasper = new PHPJasper;
$jasper->process(
$input,
$output,
$options
)->execute();
}