pdfview.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta charset="UTF-8">
  7. <title>PDF View</title>
  8. <style>
  9. html, body {
  10. height: 100%;
  11. padding: 0;
  12. margin: 0;
  13. overflow: hidden;
  14. }
  15. div {
  16. height: 100%;
  17. overflow: hidden;
  18. }
  19. object {
  20. width: 100%;
  21. height: 100%;
  22. }
  23. </style>
  24. <script src="../../o2_core/o2.min.js"></script>
  25. <script>
  26. o2.addReady(function(){
  27. const uri = new URI(window.location.href);
  28. const file = uri.getData("file");
  29. const obj = document.querySelector("object");
  30. obj.setAttribute("data", file);
  31. });
  32. </script>
  33. </head>
  34. <body>
  35. <div>
  36. <object data="" type="application/pdf">
  37. <p>It appears you don't have a PDF plugin for this browser. </p>
  38. </object>
  39. </div>
  40. </body>
  41. </html>