【问题标题】:ionic 3 Document Viewer Pluginionic 3 文档查看器插件
【发布时间】:2018-05-27 05:35:24
【问题描述】:

我正在使用Document Viewer Plugin 在我的 ionic 3 应用程序中显示 pdf 文件。 我在 assets 文件夹 中放置了一个 pdf 文件,并调用了他们在文档中提到的方法。

const options: DocumentViewerOptions = {
  title: 'My PDF'
};
this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options) 

但它不会显示任何内容。我使用了这个插件的另一个内置方法:

this.document.canViewDocument(url, contentType, options, onPossible, onMissingApp, onImpossible, onError)

它抛出 onError 回调函数,错误提示:
'不支持相对 URI。'

任何帮助,将不胜感激。

【问题讨论】:

    标签: cordova pdf ionic-framework ionic3 hybrid-mobile-app


    【解决方案1】:

    使用 File Plugin Native Ionic 并使用:

    this.file.applicationDirectory + 'www/assets/files/myFile.pdf

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      • 2013-03-19
      • 1970-01-01
      • 1970-01-01
      • 2013-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多