Hi,

01c701c145fd$006f6f70$[EMAIL PROTECTED]">
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". 
This is an information that you send correctly to the client setting contentType() with this code:

response.setContentType("application/pdf");
01c701c145fd$006f6f70$[EMAIL PROTECTED]">
Am I suppose to do something else?
what do you want to do?

D.Semprini
01c701c145fd$006f6f70$[EMAIL PROTECTED]">
 
Carmelo
 
 
----- Original Message -----
Sent: Tuesday, September 25, 2001 3:51 AM
Subject: 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 following
piece 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 me
if 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 Montanez
 
Carmelo Montanez
NIST Stop 8970
Gaithersburg, MD 20899
 


Reply via email to