How to embed a document in HTML page?

前端 未结 3 2145
你的背包
你的背包 2020-11-30 09:19

We would like to show the document (e.g. pptx, xlsx, docx, pdf, html) in a html page after retrieving it fro

相关标签:
3条回答
  • 2020-11-30 09:36

    Google docs viewer can handle this.

    try

    <html>
        <head>
            <style>
                *{margin:0;padding:0}
                html, body {height:100%;width:100%;overflow:hidden}
            </style>
            <meta charset="utf-8">
                <?php
                     $url = $_GET['url'];
                 ?>
            <title><?php echo $url; ?></title>
        </head>
        <body>
            <iframe src="http://docs.google.com/viewer?url=<?=urlencode($url)?>&embedded=true"  style="position: absolute;width:100%; height: 100%;border: none;"></iframe>
        </body>
    </html>
    
    0 讨论(0)
  • 2020-11-30 09:52

    Non-html content apart from images needs to be retrieved using an object, embed or iframe tag

    1. iframe: <iframe src="somepage.pdf"></iframe>
    2. object/embed: <object src="somepage.pdf"><embed src="somepage.pdf"></embed></object>

    somepage.pdf could be somepage.jsp?filename=somepage&mimetype=application/pdf

    Here is an interesting link How to Embed Microsoft Office or PDF Documents in Web Pages

    and here is a stackoverflow search

    0 讨论(0)
  • 2020-11-30 09:53

    If you are looking for a pure HTML version of the document (for fast rendering and cross browser support), you can go through Docspad. Docspad helps embedding all the different popular document formats into your web application. http://docspad.com

    0 讨论(0)
提交回复
热议问题