title: a4j:mediaOutput not rendering PDF
body: <p>I have a task of displaying a PDF fetched from the database as a pop up in my JSF application upon clicking a link. However my modal panel isn't rendering the PDF. Instead I get a small dark grey box at the top left corner of the panel.</p>
  
  <p>Here's my XHTML code:</p>
  
  <pre><code>&lt;rich:column styleClass="viewUserTable"&gt;
  &lt;f:facet name="header"&gt;
      &lt;h:outputText value="Pdf" /&gt;
  &lt;/f:facet&gt;
  &lt;h:outputLink value="#" id="link" style="color:blue;margin: 0 auto;"&gt;
      Proof
      &lt;rich:componentControl for="panel" attachTo="link"
          operation="show" event="onclick" /&gt;
  &lt;/h:outputLink&gt;
  &lt;rich:modalPanel id="panel" width="350" height="100"&gt;
      &lt;f:facet name="header"&gt;
          &lt;h:outputText value="PDF"&gt;&lt;/h:outputText&gt;
      &lt;/f:facet&gt;
      &lt;a4j:mediaOutput element="object" mimeType="application/pdf"
          id="media" session="false" createContent="#{getMyBean.showPdf}"
          value="1" style="width:800px; height:600px;" cacheable="false"
          standby="loading..."&gt;
      &lt;/a4j:mediaOutput&gt;
  &lt;/rich:modalPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here's the method I'm calling in my bean to create content for <code>&lt;a4j:mediaOutput&gt;</code>.</p>
  
  <pre><code>public void showPdf(OutputStream stream, Object object) throws SQLException, IOException {
  
       Blob proof= myObject.getPdf(someValue);//DB call to get the pdf
       InputStream inStream = proof.getBinaryStream();
       int length = -1;
       byte[] buffer = new byte[4096];
  
       while ((length = inStream.read(buffer)) != -1) {
           stream.write(buffer, 0, length);
       }  
  }
  </code></pre>
  
  <p>I am not sure of the significance of the <code>value</code> attribute in the <code>&lt;a4j:mediaOutput&gt;</code> but I found an example on internet where similar content was being fetched from DB and and the value was set as 1. I m using RichFaces 3.3. </p>