title: Embed PDF in HTML
body: <p>I need to embed a PDF document inside an HTML page. The PDF is dynamically generated, i.e., not a static file, but rather a byte-array generated using a PDF toolkit (in my case, "Apache PDFBox"). I have a Java Web app.</p>
  
  <p>From what I understand, there are 2 ways to embed a PDF: using the OBJECT and IFRAME tags.</p>
  
  <ul>
  <li><p>The <code>&lt;object&gt;</code> tag does not work for me. When I have a dynamically-generated source, it takes 20 sec. to render. I'm not sure if that is a problem of the Acrobat Reader plugin, but I have not been able to get around this strange behavior.</p></li>
  <li><p>The <code>&lt;iframe&gt;</code> tag works fine and displays the PDF. But here's the problem: My PDF has a Submit button which submits the form. After I submit the form, I need to re-display the PDF with some kind of status message. The form output goes to the <strong>same</strong> frame. Thus, I get a Frame-inside-a-Frame. There is no way to break out of the current frame, because I don't have access to the <code>&lt;form&gt;</code> tag. The form is contained inside the PDF and Acrobat takes care of submitting the form. If I have extra elements in my frame, such as a text message, I will get cascading frames.</p></li>
  </ul>
  
  <p>Any ideas how to resolve this?</p>