Skip to main content

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
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

// remove the head and body tags

// set the output format to html

// make the html paginate

// set the output file name

// set the base url for all actions

// Tell the Engine where to write the images to

// set the base url for the images


//Configure the emitter to handle actions and images
options2.setActionHandler(new HTMLActionHandler() );
HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );
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

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
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();

HTMLRenderOption options = new HTMLRenderOption(renderoption);



renderoption.setImageHandler(new HTMLCompleteImageHandler());

Previous Topic:Birt Flash Diagram Multiple Axes
Next Topic:[HELP]Problems when rendering in HTML through JavaBridge
Goto Forum:

Current Time: Fri May 25 13:10:37 GMT 2018

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

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

Back to the top