When generating pdf's directly to the ServletResponse.getOutputStream, the
rendering seems to intermittently fail. I have written a servlet to read the
pdf from the filesystem and buffer it to the servlets outputstream, and it
works consistently, however, when I generate a Document with the servlets
outputstream, it itermittently fails. 

Code: 
PdfWriter writer = PdfWriter.getInstance(document,
response.getOutputStream()); 


document.addTitle("Hello World example"); 
document.addSubject("Read the Code Jackass"); 
document.addKeywords("Metadata, iText, step 3, tutorial"); 
document.addCreator("My program using iText"); 
document.addAuthor("Yo Mamma"); 
document.addHeader("Expires", "0"); 
document.open(); 

document.add(new Paragraph("INSTANCE:"+ instance)); 
document.add(new Paragraph("Test Paragraph numero uno")); 
document.add(new Paragraph("Test Paragraph numero dos")); 
document.add(new Paragraph("Test Paragraph numero tres")); 


//document.close(); 
writer.flush(); 
writer.close(); 

The interesting thing about this is, when it fails, I can email the
unrendered page to myself, and it is valid. Everything looks fine. Because
this same problem does not arrise when... 
CODE: 
BufferedReader br = new BufferedReader(new InputStreamReader(new
FileInputStream(file))); 
String s = null; 
while ((s = br.readLine()) != null) sbf.append(s+"\n"); 
stream.write(sbf.toString().getBytes()); 

I have to assume there is a buffer issue with iText on generating the
document. 


any help is greatly appriciated. 
Matthew

<<attachment: winmail.dat>>

Reply via email to