I have a Laravel project and I want to create some reports using this library:

https://github.com/lavela/phpjasper

I have installed everything correctly, but I receive an error.

This is the error I get:

usage: jasperstarter process [-h] -f [ ...] [-o ] [-w]

This is my method for the generation of the report:

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();
  }

0 Answers