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".  Am I suppose to do something else?
 
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