I'm trying to integrate BIRT (3.7) with my RCP application.
When generating a report chart converted into a image (PNG,SVG, e.t). I want during generation html report make a chart (image) embedded
How to make embedded image chart in html report?
The decision to setBaseImageUrl("url") does not suit me.
I found a solution :)
...
IReportRunnable design = engine.openReportDesign(designInputStream);
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
IRenderOption options = null;
switch (format) {
case ReportFormats.HTML_REPORT:
options = new HTMLRenderOption();
options.setOutputFormat(HTMLRenderOption.HTML);
options.setOutputStream(outputStream);
options.setSupportedImageFormats("PNG");
((HTMLRenderOption) options).setEmbeddable(true);
options.setImageHandler(new HTMLServerImageHandler() {
@Override
protected String handleImage(IImage image, Object context,
String prefix, boolean needMap) {
String embeddedImage = null;
//embeddedImage = convert image.getImageStream() to Base64 String
return "data:image/png;base64," + embeddedImage;
}
});
break;
...
if (options != null) {
task.setRenderOption(options);
task.run();
task.close();
engine.destroy();
}
...