01c701c145fd$006f6f70$[EMAIL PROTECTED]">This is an information that you send correctly to the client setting contentType() with this code:When the PDF data is sent back to my client. Am I suppose to tell my client(IE6) that this is a PDF file (or a stream). I do set response.contentType to"application/pdf".
response.setContentType("application/pdf");
01c701c145fd$006f6f70$[EMAIL PROTECTED]">what do you want to do?Am I suppose to do something else?
D.Semprini
01c701c145fd$006f6f70$[EMAIL PROTECTED]">Carmelo----- Original Message -----From: Semprini DavideSent: Tuesday, September 25, 2001 3:51 AMSubject: Re: Anything wrong with this code>Hi,
PDF file is a binary file!!!
Use this code it's work:
byte[] content = outPDF.toByteArray();
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
D.Semprini
Carmelo Montanez wrote:
02be01c1452d$7953e270$[EMAIL PROTECTED]" type="cite">Hi All:I know that my browser can display PDF propertly now, however the followingpiece of code (that generates PDF data) sends the data back to the client(IE6) and still does not not looks like PDF at all. Can someone please tell meif there is something wrong with this code. By the way(out = response.getOutputStream() and "foFile" comes from an "FO" file).public void renderFO(InputSource foFile, HttpServletResponse response)
throws IOException
{
try {
ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
response.setContentType("application/pdf");
Driver driver = new Driver(foFile, outPDF);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(outPDF);
driver.run();byte[] content = outPDF.toByteArray();
response.setContentLength(content.length);
out.write(content);
out.flush();
}
catch (Exception ex) {
System.out.println(ex);
}Thanks,Carmelo MontanezCarmelo Montanez
NIST Stop 8970
Gaithersburg, MD 20899