2 Replies Latest reply on Oct 21, 2010 12:52 AM by sriramsudheer

    PDF and mediaoutput

      Hi,
      i tried to display an pdf file with mediaout. I do it this way.

      <a4j:mediaOutput cacheable="false" session="true" createContent="#
      {painter.paint}" element="object" mimeType="application/pdf" value="RichFaces-Jay.pdf"></a4j:mediaOutput>
      
      


      and the paint method is this one :

       public void paint(OutputStream out, Object data)
       throws IOException {
      
       if(breakPoint){
      
       String fileName=(String)data;
       String filePath="C:\\pdfFiles";
       File f=new File(filePath, fileName);
      
       _logger.info("I am trying to display "+data);
      
       byte[] buf = getBytesFromFile(f);
       FileInputStream inStream = new FileInputStream(f);
      
       inStream.read(buf);
      
       inStream.close();
       out.write(buf);
       out.close();
      
       breakPoint = false;
      
       }
      
       }
      


      The paint method is called, the file is loaded but i can't see any output on the page. I tried the same way with an jpeg file and it works.

      Is it impossible to display pdf files with mediaoutput?

      Best regards

      Kalomo