Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » BIRT 4.3 creates invalid PDF
BIRT 4.3 creates invalid PDF [message #1328773] Fri, 02 May 2014 21:40 Go to next message
Steve Bliss is currently offline Steve Bliss
Messages: 15
Registered: February 2011
Junior Member
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 18:02 Go to previous message
Steve Bliss is currently offline Steve Bliss
Messages: 15
Registered: February 2011
Junior Member
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.
Previous Topic:Parameter dialog does not display
Next Topic:Setup on Glassfish 4
Goto Forum:
  


Current Time: Fri Oct 31 08:50:03 GMT 2014

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

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