zoukankan      html  css  js  c++  java
  • IE、Chrome等浏览器实现PDF预览(原)

    IE、Chrome等浏览器实现PDF预览
    <!doctype html>
    <html>
        <head>
            <meta http-equiv="content-type" content="text/html; charset=gb2312">
            <meta http-equiv="content-style-type" content="text/css">
            <meta http-equiv="content-script-type" content="text/javascript">
            <title>Checking If PDF Can Preview...</title>
            <script type="text/javascript">
                function checkPDF(){
                    /*if(!!(document.getElementById('PDFNotKnown'))){
                        document.getElementById('IfNoPDFAXExist').style.display = "block";
                    }
                    else{
                        document.getElementById('IfPDFAXExist').style.display = "block";
                    }*/
                    document.getElementById('PDFViewObject').style.display = "block";

                }           
            </script>
        </head>
        <body onload="checkPDF()">
            <noscript>
                cannot determine if you have acrobat reader (or the full acrobat)
                installed <font size="-1">(because javascript is unavailable or
                turned off)</font>.
            </noscript>
            <!--<div id="IfNoPDFAXExist" style="display:none">
                你需要先安装pdf阅读器才能正常浏览文件,请点击<a href="http://get.adobe.com/cn/reader/download/?installer=reader_11.0_chinese_simplified_for_windows" target="_blank">这里</a>下载.
            </div>-->

            <object id="PDFViewObject" type="application/pdf" width='100%' height='100%' data='mxl.pdf' style="display:none">
                <!--这里面的div只有浏览器不支持application/pdf时才会被显示-->
                <!--IE8以及以下版本的IE在浏览器不支持application/pdf时不会加载下面的div从而可以通过上面的checkPDF来处理,
                IE9以及以后的版本以及Chrome都会加载,所以无效-->

                <div id="PDFNotKnown">你需要先安装pdf阅读器才能正常浏览文件,请点击<a href="http://get.adobe.com/cn/reader/download/?installer=reader_11.0_chinese_simplified_for_windows" target="_blank">这里</a>下载.</div>
            </object>
            <!--<embed id="IfPDFAXExist" style="display:none" width="100%" height="100%" name="plugin" src="mxl.pdf" type="application/pdf">-->
        </body>
    </html>




  • 相关阅读:
    <Listener>HttpSessionListener和HttpSessionAttributeListener区别
    @WebFilter怎么控制多个filter的执行顺序
    Springboot+Mybatis+MySQL实例练习时踩坑记录
    Git学习篇之git remote add origin错误
    Springboot高版本中@ConfigurationProperties注解取消location属性
    mevan中GroupId和ArtifactId到底怎么填?
    sqrt()函数对素数判断的优化
    oj错误之char型超出范围
    排序算法之桶排序
    Spring中常用注解
  • 原文地址:https://www.cnblogs.com/boulder/p/c2f99c56d8462ecd460c1e3aef3b307a.html
Copyright © 2011-2022 走看看