Programming using the BIRT Reporting APIs : Generating reports from an application : Setting up the report engine : How to set up a report engine as a stand-alone application
 
How to set up a report engine as a stand-alone application
Listing 12‑1 shows an example of setting up a report engine as a stand-alone application on a Windows system. The application uses the BIRT home located in the BIRT run-time directory. The report output format is HTML.
Listing 12‑1 Setting up the report engine for a stand-alone application
// Create an EngineConfig object.
EngineConfig config = new EngineConfig( );
// Set up the path to your BIRT home directory.
config.setBIRTHome( "C:/Program Files/birt-runtime-2_6_0/ReportEngine" );
// Start the platform for a non-RCP application.
try
{
Platform.startup( config );
IReportEngineFactory factory = ( IReportEngineFactory ) Platform.createFactoryObject ( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
// Set up writing images or charts embedded in HTML output.
HTMLRenderOption ho = new HTMLRenderOption( );
ho.setImageHandler( new HTMLCompleteImageHandler( ));
config.setEmitterConfiguration
( RenderOption.OUTPUT_FORMAT_HTML, ho );
// Create the engine.
IReportEngine engine = factory.createReportEngine( config );
}
catch ( BirtException e ) { e.printStackTrace(); }