Hi all!

I am generating PDF file in a JSP page. I did several pages using the same concept. some of them works fine. But some kept either giving me "file is damaged and can not be repaired" error or generating a bunch of strange character on the screen.

I tried to pull out information from database. It seems that the correct data were pulled out, but just were not outputed corretly.

This is what I use for the output:

DataOutput output = new DataOutputStream( response.getOutputStream() );
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for( int i = 0; i < bytes.length; i++ ) { output.writeByte( bytes[i] ); }


Can anybody give me some hints?

Thanks,

tianlun


Reply via email to