Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Image won't be stored in directory specified(Setting Render options for images)
Image won't be stored in directory specified [message #662204] Tue, 29 March 2011 17:48 Go to next message
Olly   is currently offline Olly Friend
Messages: 61
Registered: June 2010
Location: Florida
Member
I'm running BIRT 2.6.1 and I'm trying to set the HTMLRenderOptions properly to have the image save to a directory of my choosing. Unfortunately its not working and I think I may be missing something. Here is my code, which I got from some sample code:
// create a renderoption object
HTMLRenderOption options2 = new HTMLRenderOption();

// create a byte arrayoutputstream object
//outStream = new ByteArrayOutputStream();

// set the outputstream to bytearrayoutputstream object
//options2.setOutputStream(outStream);

// remove the head and body tags
options2.setEmbeddable(false);

// set the output format to html
options2.setOutputFormat(outputFormat);

// make the html paginate
options2.setHtmlPagination(true);

// set the output file name
options2.setOutputFileName(outFileName+outputFormat);

// set the base url for all actions
options2.setBaseURL(baseURL);

// Tell the Engine where to write the images to
options2.setImageDirectory(imageDirectory);

// set the base url for the images
options2.setBaseImageURL(baseURL);

options2.setSupportedImageFormats("JPG");

//Configure the emitter to handle actions and images
options2.setActionHandler(new HTMLActionHandler() );
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );
options2.setImageHandler(imageHandler);
config.getEmitterConfigs().put("html", options2);

HashMap<String, HTMLRenderOption> contextMap = new HashMap<String, HTMLRenderOption>();
contextMap.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, options2);
task.setAppContext( contextMap );

// set the rendering options for the task
task.setRenderOption(options2);

Does anyone see that I'm missing anything. I tried to get rid of all the deprecated classes like htmlrendercontext & htmlemitterconfig from the sample code and thats when things went wrong.
Re: Image won't be stored in directory specified [message #662222 is a reply to message #662204] Tue, 29 March 2011 18:34 Go to previous message
Olly   is currently offline Olly Friend
Messages: 61
Registered: June 2010
Location: Florida
Member
Never mind, I think I got it. I followed the newer example on the report engine api page. Now my code looks like the following, taken from the api page,
// open the report design
IReportRunnable design = engine.openReportDesign(reportDesign);

//Create task to run and render the report,
IRunAndRenderTask task = engine.createRunAndRenderTask(design);

task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOA DER_KEY, ExecuteModifiedReport.class.getClassLoader());

// build the report
ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle( );
buildReport( report );

IRenderOption renderoption = new RenderOption();
renderoption.setOutputFormat(renderFormat);
renderoption.setOutputFileName(outFileName+renderFormat);

HTMLRenderOption options = new HTMLRenderOption(renderoption);

options.setImageDirectory(imageDirectory);

options.setHtmlPagination(true);

renderoption.setImageHandler(new HTMLCompleteImageHandler());

task.setRenderOption(options);
Previous Topic:Birt Flash Diagram Multiple Axes
Next Topic:[HELP]Problems when rendering in HTML through JavaBridge
Goto Forum:
  


Current Time: Fri Nov 21 16:52:44 GMT 2014

Powered by FUDForum. Page generated in 0.02016 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software