【发布时间】:2018-09-12 14:39:18
【问题描述】:
我从 Ionic Document https://ionicframework.com/docs/native/document-viewer/ 阅读了文档,但我找不到在应用程序内打开文档文件(如 doc、ppt)的最佳方法。有解决问题的建议吗?
所以基本上我想将每个文档文件转换为 HTML,以便用户可以通过应用程序打开文件。有什么建议吗?
这是我的 TS 文件:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { DocumentViewer, DocumentViewerOptions } from '@ionic-native/document-viewer';
@IonicPage()
@Component({
selector: 'page-e-learning',
templateUrl: 'e-learning.html',
})
export class ELearningPage {
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public document: DocumentViewer
) {
const options: DocumentViewerOptions = {
title: 'My PDF'
}
this.document.viewDocument('https://s1.q4cdn.com/806093406/files/doc_downloads/test.pdf', 'application/pdf', options)
}
ionViewDidLoad() {
console.log('ionViewDidLoad ELearning');
}
}
【问题讨论】:
-
您的文档在哪里?它在您的设备上吗?
-
请编辑问题并从上到下更具体,显示您的代码,您卡在哪里。
-
@JuniorGantin 我正在我的浏览器上测试它,我想在我的 ionic 应用程序上阅读文档文件。
-
@MunimMunna 我在上面添加了我的代码,你能找到我的解决方案吗?
-
您找到解决方案了吗?我也有同样的问题
标签: javascript angular ionic-framework ionic3