• js预览PDF的插件(亲测支持IE9,火狐,等等)


    aspx文件

    <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%=PdfTitle%></title>
    <link href="../JS/Pdf_JS/css/default.css" rel="stylesheet" />
    <link href="../JS/Pdf_JS/css/jquery.touchPDF.css" rel="stylesheet" />
    <link href="../JS/Pdf_JS/css/normalize.css" rel="stylesheet" />

    <!--[if IE]>
    <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
    </head>
    <body>

    <div id="myPDF" style="height: 95%; 95%; margin: auto;"></div>


    <script src="../JS/Pdf_JS/js/jquery-1.11.0.min.js"></script>
    <script src="../JS/Pdf_JS/js/pdf.compatibility.js"></script>
    <script src="../JS/Pdf_JS/js/pdf.js"></script>
    <script src="../JS/Pdf_JS/js/jquery.touchSwipe.js"></script>
    <script src="../JS/Pdf_JS/js/jquery.touchPDF.js"></script>
    <script src="../JS/Pdf_JS/js/jquery.panzoom.js"></script>
    <script src="../JS/Pdf_JS/js/jquery.mousewheel.js"></script>
    <script type="text/javascript">

    $(function () {
    $("#myPDF").pdf({
    // source: "../JS/Pdf_JS/demo.pdf",
    source: "<%=PdfPath%>",
    tabs: [
    { title: "Section 1", page: 2, color: "orange" },
    { title: "Section 2", page: 3, color: "green" },
    { title: "Section 3", page: 5, color: "blue" },
    ]
    });
    });

    </script>

    </body>
    </html>

    aspx.cs文件:就是传了个路径

    public partial class SearchLookPDF : System.Web.UI.Page
    {
    public string PdfTitle;
    public string PdfPath;

    protected void Page_Load(object sender, EventArgs e)
    {
    PdfPath = Context.Request.QueryString["RelativePath"];
    int a = PdfPath.IndexOf("FileData");
    PdfPath = "../"+PdfPath.Substring(a);
    //source: "../JS/Pdf_JS/demo.pdf",

    PdfTitle = PdfPath.Substring(PdfPath.LastIndexOf("/")+1);

    ;


    }
    }

    JS文件的连接:  http://files.cnblogs.com/files/liuwenxu/Pdf_JS.rar

  • 相关阅读:
    HDU1720 A+B Coming
    HDU1390 ZOJ1383 Binary Numbers
    HDU1390 ZOJ1383 Binary Numbers
    HDU2504 又见GCD
    HDU2504 又见GCD
    HDU1335 POJ1546 UVA389 UVALive5306 ZOJ1334 Basically Speaking
    HDU1335 POJ1546 UVA389 UVALive5306 ZOJ1334 Basically Speaking
    HDU1020 ZOJ2478 Encoding
    HDU1020 ZOJ2478 Encoding
    HDU2097 Sky数
  • 原文地址:https://www.cnblogs.com/liuwenxu/p/6278641.html
Copyright © 2020-2023  润新知