liuleilei
2023-08-14 51e824c7890802b0dd4143dddb487ef26aec134a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="en">
 
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>PDF预览</title>
  <link rel="stylesheet" href="./pdfh5.css">
  <script src="./pdf.js"></script>
  <script src="./pdf.worker.js"></script>
  <script src="./jquery-1.11.3.min.js"></script>
  <script src="./pdfh5.js"></script>
  <script src="./vue.js"></script>
  <style>
    html, body {
      width: 100%;
      height: 100%;
      padding: 0;
      margin: 0;
    }
    .main {
      width: 100%;
      height: 100%;
      overflow-y: auto;
    }
  </style>
</head>
 
<body>
  <div class="main" id="pdf"></div>
  <script>
    let data = GetRequest()
 
    var pdfh5 = new Pdfh5('#pdf', {
      pdfurl: data.url
    })
 
    function GetRequest() {
      var url = encodeURI(location.search)
      var theRequest = new Object()
      if (url.indexOf("?") != -1) {
        var str = url.substr(1)
        strs = str.split("&")
        for (var i = 0; i < strs.length; i++) {
          theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
      }
      return theRequest
    }
  </script>
</body>
 
</html>