sigedi/jasper-report-bundle

Symfony 6 / Symfony Flex Bundle integrating the Jaspersoft REST v2 client (jaspersoft/rest-client)

Installs: 8 274

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 3

Open Issues: 0

Type:symfony-bundle

2.0.0 2024-01-31 14:12 UTC

This package is auto-updated.

Last update: 2025-06-05 19:04:52 UTC


README

Requirements

Packagist PHP Version Packagist Dependency Version

The JasperReportBundle requires jaspersoft/rest-client and provides an JasperReport-Client as service in the Symfony service container.

Installation
Basic Usage
Additional configuration options

Installation

1 Add bundle to composer.json:

    composer require sigedi/jasper_report_bundle

2 The Bundle will be registred automatically and by executing the recipe the configuration file jasper-report.yaml will be created in the config/packages directory and the corresponding entries in the .env file will be made

3 Change the standard setting in the file jasper-report.yaml

    sigedi_jasper_report:
        host:      'http://localhost:8080/jasperserver'
        username:  '%env(SIGEDI_JASPER_REPORT_USERNAME)%'
        password:  '%env(SIGEDI_JASPER_REPORT_PASSWORD)%'
        org_id:    '%env(SIGEDI_JASPER_REPORT_ORGID)%'

and in the .env file

SIGEDI_JASPER_REPORT_USERNAME=jasperadmin
SIGEDI_JASPER_REPORT_PASSWORD=jasperadmin
SIGEDI_JASPER_REPORT_ORGID=

Basic Usage in Symfony

The bundle supports autowiring, so you can access the report-service directly in your controller, e.g.

    use Symfony\Component\HttpFoundation\Request;
    use Sigedi\JasperReportBundleReportService;

    public function reportAction(Request $request, ReportService $reportService)
    {
        $report = $reportService->runReport('/reports/TestReport', 'pdf');

        $response = new Response($report);
        $response->headers->set('Content-type', 'application/pdf');
        $response->headers->set('Content-Disposition', 'inline; filename=Report.pdf');
        $response->headers->set('Cache-Control', 'must-revalidate');

        return $response;
    }

Additional Configuration Options

    sigedi_jasper_report:
        host:      'http://localhost:8080/jasperserver'
        username:  '%env(SIGEDI_JASPER_REPORT_USERNAME)%'
        password:  '%env(SIGEDI_JASPER_REPORT_PASSWORD)%'
        org_id:    '%env(SIGEDI_JASPER_REPORT_ORGID)%'
        timeout:   50

timeout: timeout for REST-request (in seconds)