..

BIRT Report Engine command-line cheatsheet

Posted October 9, 2014

Download and usage

Eclipse BIRT Download - BIRT demos and sample .rptdesign files

Download and unzip BIRT Runtime Release. This package includes a ReportEngine directory that contains a shell script genReport.sh and a batch version of the script (for Windows).

Rendering a BIRT report in PDF or HTML with command-line is easy with this script.

The environment variable BIRT_HOME must be set before calling the script. From the folder ReportEngine, the script can be use like this : “BIRT_HOME=… ./genReport.sh [arguments]”

Most useful commands

Render a report in PDF

./genReport.sh --format PDF --output output.pdf source.rptdesign

Render a report in HTML

Render a single HTML page

./genReport.sh --format HTML --output report.html source.rptdesign

Render a HTML reportlet

A reportlet is the same as a HTML page but BIRT doesn’t add css or html tags to wrap the html report. This option is useful for custom dashboards.

./genReport.sh --format HTML --htmlType ReportletNoCSS --output report.html source.rptdesign

Set report parameters

Set report parameters with the parameter argument

./genReport.sh --format PDF --parameter YEAR=2013 --parameter MONTH=8 --output output.pdf source.rptdesign

Also, the short version :

./genReport.sh --format PDF -p YEAR=2013 -p MONTH=8 --output output.pdf source.rptdesign

Set report parameters with a file

# file myparams.properties
YEAR=2013
MONTH=8
./genReport.sh --format PDF -F myparams.properties --output output.pdf source.rptdesign

Exemple of call from python

import os
from subprocess import call
os.environ.copy()
# tells python that we will use the same environment variables
report_path = '/opt/reports/myreport.rptdesign'
call(['bash', './genReport.sh', '--format', 'PDF', '-p', 'RP_CLIENT=' + client, '--output', client + '.pdf', report_path])
#TODO: send the pdf file via email

This page is a translation from French of an article I made for www.clubnix.fr.


author Philippe LewinWritten by Philippe Lewin, French Software Engineer. twitter