using the birt runtime with spring boot and gradle to generate PDF from a Report Design File

Warning: at the moment not recommended as solution.
Personal Note (too complicated to keep in my brain / transient memory)

birt simply does not think in this way: push data into report vs pull datasource, osgi vs. maven, design time jars....


Step 1: use with gradle:


  • get dependencies from maven repo:

compile (group: 'org.eclipse.birt.runtime', name: 'org.eclipse.birt.runtime', version: '4.4.1') {
   exclude module: 'flute'   exclude module: 'org.eclipse.orbit.mongodb' }
// also working 4.2.1a 
// not compiling:  4.6.0-20160607// not running: 4.5.0a


Step 2: create POJO and a suitable BIRT DataSource for the Designer:



Step 3: use BIRT runtime in your Spring Boot Controller:


InputStream reportDesign = getClass(). getResourceAsStream("/static/exampleWithData.rptdesign");..// put list with pojos there ..appContext.put("APP_CONTEXT_KEY_DATA_SET", (new ReportSampleDataSet().getSampleData()));runAndRenderTask.setAppContext(appContext); .. ans so on.


Step 4: create BIRT Report below main/resources/static/:

  • as shown in all the designer tutorials
  • POJO Datasource, POJO Dataset, key as above (APP_CONTEXT_KEY_DATA_SET)
  • use jar-File with POJO in it to design the Report
Step 5: patch the rptdesign XML File:
  • remove  the following xml element 
here-is-the-pojo-jarfile.jar;
Done, do a gradlew bootRun and pray...

Kommentare

Beliebte Posts aus diesem Blog

Powershell snippet to send messages to telegram