【问题标题】:Ionic: Unable to open the PDF from URL in AndroidIonic:无法从 Android 中的 URL 打开 PDF
【发布时间】:2021-01-24 03:52:24
【问题描述】:

分享我的系统环境:

Ionic:

   Ionic CLI          : 6.11.9 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res                          : 0.15.1
   native-run (update available: 1.2.1) : 1.1.0

System:

   NodeJS : v12.18.4 (/usr/local/bin/node)
   npm    : 6.14.8
   OS     : macOS Catalina

使用 Ionic 3 项目,我将无法显示 PDF 和 http 状态代码返回是

206 Partial Content

我为最新版本安装了https://github.com/apache/cordova-plugin-inappbrowser。这是我的一段代码:

window.open('http://www.orimi.com/pdf-test.pdf', '_system');

Config.xml

<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />

【问题讨论】:

    标签: android pdf ionic-framework ionic3 inappbrowser


    【解决方案1】:

    请参考此链接 - https://ionicframework.com/docs/v3/native/in-app-browser/

    import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
    
    constructor(private iab: InAppBrowser) { }
    
    openPdf(){
      this.iab.create('http://www.orimi.com/pdf-test.pdf');
    }
    

    【讨论】:

      猜你喜欢
      • 2021-01-10
      • 2016-07-15
      • 1970-01-01
      • 2013-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-17
      相关资源
      最近更新 更多