PDFRender - OutputStream not closed ? [message #1018881] |
Thu, 14 March 2013 16:03 |
|
Hi,
In an Eclipse RCP application, I have a report which is generated by default in HTML and displayed in the standard Web viewer. After that, the user can choose to export the report in PDF, XLS, etc.
To do this, the HTML rendering is separated in two tasks : a Run task and a Render task. Like this, the Run task generate a rptDocument file which can be reused for the different exports.
My problem occures with the PDF export. In fact, one time in three, the PDF file is well created but it's still locked by the JVM, thus I can't open or delete the file. If I close my application, the lock is released and I can correctly open or delete the pdf file.
Is it a Bug or do I forget to close something correctly ?
Here is the code of my export :
// Open the rptDocument
reportDocument = getReportEngine().openReportDocument(rptDocumentPath);
// Create the render task, configured for the wanted export format
IRenderTask renderTask = getReportEngine().createRenderTask(reportDocument);
IRenderOption options = new RenderOption();
options.setOutputFormat("pdf");
options.setOutputFileName("myfile.pdf");
renderTask.setRenderOption(options);
try {
// Launch the render task and close it
renderTask.render();
renderTask.close();
// Close the rptDocument
reportDocument.close();
// Finally, open the target file with the right application
Program.launch(exportFileName);
} catch (final EngineException e) {
Syso ....
}
Thanks
ALL4TEC
|
|
|
|
|
|
|
|
|
Re: PDFRender - OutputStream not closed ? [message #1029753 is a reply to message #1027813] |
Sat, 30 March 2013 04:47 |
|
I did a similar thing. I created a output directory under my project root named output and when I generated the rptdocument I wrote it to this directory:
task.run("output/resample/pdf.rptdocument");
I then read it like:
IReportDocument doc= engine.openReportDocument("output/resample/pdf.rptdocument");
Later I did a doc.close();
|
|
|
Powered by
FUDForum. Page generated in 0.03955 seconds