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]”
./genReport.sh --format PDF --output output.pdf source.rptdesign
./genReport.sh --format HTML --output report.html source.rptdesign
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
./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
# file myparams.properties
YEAR=2013
MONTH=8
./genReport.sh --format PDF -F myparams.properties --output output.pdf source.rptdesign
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.
Written by Philippe Lewin, French Software Engineer. twitter