Embed PDF in HTML

Can someone help me? I need to embed a PDF document inside an HTML page. The PDF is dynamically generated, ie, 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.

From what I understand, there are 2 ways to embed a PDF: using the OBJECT and IFRAME tags.

  • The <object> 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.

  • The <iframe> 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 same 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 <form> 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.

  • Any ideas how to resolve this? Thanks


    <object data="myfile.pdf" type="application/pdf" width="100%" height="100%">
    
      <p>It appears you don't have a PDF plugin for this browser.
      No biggie... you can <a href="myfile.pdf">click here to
      download the PDF file.</a></p>
    
    </object>
    

    有关更多详细信息和示例,请访问此URL:http://pdfobject.com/markup/index.php


    You can use pdf.js by mozilla.

    Resource: Embed PDF in HTML

    链接地址: http://www.djcxy.com/p/6214.html

    上一篇: 如何让HTML链接看起来像一个按钮?

    下一篇: 在HTML中嵌入PDF