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"; //数字是页面布局高度差 },

      

  • 相关阅读:
    .NET创建WebService服务简单的例子
    SVN服务器搭建
    Visual Studio 2017 系统发布部署服务器教程
    C#进阶--WebApi异常处理机制
    利用iis虚拟目录实现文件服务器功能(分布式存储)
    jQuery 选择器
    jQuery 简介
    从「闭包」到 思考人生
    跨域
    ajax 和 mock 数据
  • 原文地址:https://www.cnblogs.com/linm/p/13821030.html
Copyright © 2011-2022 走看看