Home
Analytics
birt report server and client issues
asilo1
i am trying to access reports using beans and i can run the report engine get everything working. Only problem is sending the report from server to client side images stay in the server side. Is there anyway i can send the images with the report or is there any renderer will send a image as report. i cant use port at server due to security issues so somehow i need to send the report from server side as whole and delete the created images and display in the client side which is swing/jide.
try {
// Open the report design
ByteArrayOutputStream stream = new ByteArrayOutputStream();
IReportRunnable design = engine.openReportDesign(reportPath);
// Options
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputStream(stream);
options.setImageDirectory(imagePath);
options.setBaseImageURL(imagePath);
options.setOutputFormat("html");
options.setSupportedImageFormats( "PNG;GIF;JPG;BMP;SWF");
//Setting this to true removes html and body tags
options.setEmbeddable(true);
// options.setEnableInlineStyle(true);
// Create report render task.
task.setRenderOption(options);
//Setting this to true removes html and body tags
task.setParameterValues(parameters);
//run and render report
task.run();
task.close();
LOGGER.info("The report output size: " + stream.size());
result = stream.toString();
} catch (Exception ex) {
throw new Exception("Generated report failed", ex);
}
}
// LOGGER.info("The report output size: " + stream.size());
result = stream.toString();
return Result;
Find more posts tagged with
Comments
JasonW
I assume the output has to be in html? If so does the browser support using the data attribute on the src tag? If so you could inline the base64 encoded image data. Take a look at the attached example report that does this for some images. This will not work for charts, but you could write an image handler to do it.
Read over this section:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#emitterconfiguration
You can implement your own instance of the IHTMLImageHandler interface.
Jason