zoukankan      html  css  js  c++  java
  • 安卓在线读取pdf失败

    安卓在线读取pdf不能直接打开,而ios可以;

    是因为安卓的webView不支持导致的,

    解决----引入pdf.js文件

    在iframe

     <div class="outer">
          <iframe
            class="show-box"
            :src="'http://uattest.tppension.cntaiping.com/static/mjcd/static/pdf/web/viewer.html?file='+ url"
            id="myiframe"
            scrolling="no"
            frameborder="0"
            width="100%"
            border="0"
          ></iframe>
        </div>
    

      注意:百度到的src路径前面没有域名,只能在本地调试,放到测试或生产上不行,所以要加域名

     created() {
        // // 显示loding
        // Indicator.open("加载中...");
        this.url=encodeURIComponent(this.pdfLink)
        console.log(this.url);
        setTimeout(() => {
          console.log("组件里面显示pdf链接", this.pdfLink);
        }, 0);
        alert('/static/pdf/web/viewer.html?file='+ url)
      },
      props: ["pdfLink"],
      data() {
        return {
          url:""
        };
      },
    

      

     
    mounted() { const myiframe = document.getElementById("myiframe"); const deviceWidth = document.documentElement.clientWidth; const deviceHeight = document.documentElement.clientHeight; myiframe.style.overflow = "scroll"; // myiframe.style.width = Number(deviceWidth) + "px"; //数字是页面布局宽度差值 myiframe.style.height = Number(deviceHeight) + "px"; //数字是页面布局高度差 },

      

  • 相关阅读:
    转:每个架构师都应该研究下康威定律
    使用OpenShiftFQ上外网
    关系模式设计
    数据库应用系统工程过程
    数据库系统
    四种常见 Git 工作流比较
    Git 进阶指南
    C#高性能TCP服务的多种实现方式
    浮动广告
    <span></span>
  • 原文地址:https://www.cnblogs.com/linm/p/13821030.html
Copyright © 2011-2022 走看看