BIRT 4.3 creates invalid PDF [message #1328773] |
Fri, 02 May 2014 17:40  |
Eclipse User |
|
|
|
I'm generating a single report in a J2EE webapp, and the resulting PDF file won't open in Adobe Reader. I get this message:
"There was an error opening this document. The file is damaged and could not be repaired."
My app is running in RAD 8.5, using BIRT 4.3.2 jars, compiling to Java 1.7. The report is written with a scripted data set. The data is being passed to the report via the report parameters.
The report seems to be executing correctly. If I switch the format to postscript, the output document is good.
Here is the core of the Java code:
// report gets one record, in letterFields
InputStream designFile = this.getClass().getResourceAsStream("myreport.rptdesign");
IReportRunnable design = engine.openReportDesign(designFile);
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
RenderOption options = new RenderOption();
options.setOutputFormat("pdf");
CircularByteBufferEx cbb = new CircularByteBufferEx(CircularByteBuffer.INFINITE_SIZE);
options.setOutputStream(cbb.getOutputStream());
task.setRenderOption(options);
// pull together data to pass to engine task
LetterBodyData lbd = new LetterBodyData();
lbd.load(letterFields);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("LetterBody", lbd);
task.setParameterValues(parameters);
// generate the output
task.run();
task.close();
cbb.getOutputStream().close();
// save the document
FileOutputStream fos = new FileOutputStream("c:\temp\myreport.pdf");
fos.write(cbb.getBuffer(), 0, cbb.getSize());
fos.close();
Any suggestions would be appreciated!
|
|
|
Re: BIRT 4.3 creates invalid PDF [message #1334682 is a reply to message #1328773] |
Mon, 05 May 2014 14:02  |
Eclipse User |
|
|
|
Update: the problem seems to be related to two PNG images in the report design. Are there known issues with BIRT 4.3.2 handling images?
One of the images will work, if I convert it to JPG. The other image won't work in PNG, JPG, or GIF formats.
|
|
|
Powered by
FUDForum. Page generated in 0.05050 seconds