Hello Kasim, probably you're sending an empty document (0 bytes) or an Exception is thrown. This leads to an HTML-Document being send from the Webserver to the client, if you don't catch the Exception.
Maybe you should use a tracing tool. My favorite is wfetch (Microsoft). One solution is to catch all Exception and rethrow them while setting the Content-Type back to "text/html". Peter -----Ursprüngliche Nachricht----- Von: Kasim Chen [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 11. November 2003 09:07 An: [EMAIL PROTECTED] Betreff: [iText-questions] File does not begin with '%PDF-' I generate my PDF with iText through servlet and show the result directly to browser (using ByteArrayOutputStream method), but on "some" PCs give the error message "File does not begin with '%PDF-'" when the browser tries to open the PDF. Does this error happen due to connection problem (so that the data stream is not completely received by client-side) ? What should I do to solve this problem ? My codes: ByteArrayOutputStream baosPDF = null; baosPDF = generatePDFDocument(); response.setHeader("Content-disposition", "inline; filename=report.pdf"); response.setContentType("application/pdf"); response.setContentLength(baosPDF.size()); ServletOutputStream sos = response.getOutputStream(); baosPDF.writeTo(sos); sos.flush(); sos.close(); _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions