Skip to content
Symfony 2 Bundle integrating the Jaspersoft REST v2 client (jaspersoft/rest-client)
PHP HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Controller
DependencyInjection
Resources
Tests/Controller
Factory.php
HboieJasperReportBundle.php
README.md
composer.json

README.md

JasperReportBundle

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

Installation

1 Add bundle to composer.json:

    composer require hboie/jasper_report_bundle

2 Register bundle in app/AppKernel.php:

    $bundle = [
            ...
    new Hboie\JasperReportBundle\HboieJasperReportBundle(),
            ...
    ];

3 Add parameter to app/config/config.yml

    hboie_jasper_report:
        host:      "%jasper_host%"
        username:  "%jasper_user%"
        password:  "%jasper_password%"
        org_id:    "%jasper_org_id%"

4 Add a dummy configuration in app/config/paramters.yml.dist

    jasper_host: http://localhost:8080/jasperserver
    jasper_user: jasperadmin
    jasper_password: jasperadmin
    jasper_org_id:

5 Add your own configuration in app/config/paramters.yml

Usage

You can now access the Client object via the Symfony service jasperreport.client:

    $client = $this->get('jasperreport.client');

or directly access the ReportService using the Symfony service jasperreport.reportservice:

    $report = $this->get('jasperreport.reportservice')->runReport('/reports/TestReport', 'pdf');

So a controller giving back a pdf-report would look like

    public function reportAction(Request $request)
    {
        $report = $this->get('jasperreport.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;
    }
You can’t perform that action at this time.