How do you export a birt report using javascript at runtime?
The code that I have tried is in the After Render event:
importPackage(Packages.org.eclipse.birt.report.engine.api);
rptdoc = reportContext.getReportRunnable().getReportName();
// Open the rptDocument
reportDocument = getReportEngine().openReportDocument(rptdoc);
// Create the render task, configured for the wanted export format
IRenderTask renderTask = getReportEngine().createRenderTask(reportDocument);
IRenderOption options = new RenderOption();
options.setOutputFormat("pdf");
options.setOutputFileName("C:/test/myfile.pdf");
renderTask.setRenderOption(options);
// Launch the render task and close it
renderTask.render();
renderTask.close();
// Close the rptDocument
reportDocument.close();
It runs and there are no errors but no pdf gets generated...
My requirement is to run the birt report using an URL and the report should generate itself in a folder as a pdf.
The report should only execute once. I don't want to execute the URL and then in the report it does another runAndRender in after factory, the report should export itself. Hope this makes sense.
I am using Birt 4.5.