html 预览pdf文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>在指定div中浏览PDF</title>
    <!--在此引入bootstrap只为初始化样式div样式-->
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <style type="text/css">
        /* 添加样式是为了实现全屏效果 */
        html, body
        {
            height: 100%;
            overflow: hidden;
        }
        #pdfDiv
        {
            height: 100%;
        }
        .pdfobject-container
        {
            /* height: 500px; */
        }
        .pdfobject
        {
            /* border: 1px solid #666; */
        }
    </style>
</head>
<body>
    <div id="pdfDiv">
    </div>
    <script src="Scripts/js/pdfobject.min.js" type="text/javascript"></script>
    <script src="Scripts/js/viewer.js" type="text/javascript"></script>
    <script type="text/javascript">
        //本地路径pdf文件放在项目的DemoFiles文件夹下
                PDFObject.embed("DemoFiles/软件.pdf", "#pdfDiv");
        //        PDFObject.embed("ftp://192.168.10.112/Test.pdf");
    </script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/tone1128/article/details/89396761