如何使用ionic 3将pdf文件打开到div或tab中?使用下面 我可以通过appf外面的pdf阅读器打开pdf代码。我想把它展示成一个div。请给我一些建议。
import { DocumentViewer } from '@ionic-native/document-viewer';
constructor(private document: DocumentViewer) { }
...
const options: DocumentViewerOptions = {
title: 'My PDF'
}
this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options)
答案 0 :(得分:1)
您可以将pdf查看器组件用于Angular 2+应用程序。 您可以自己编写或使用npm中的一些。 示例:https://github.com/VadimDez/ng2-pdf-viewer
模板:
<ion-content>
<pdf-viewer
[src]="pdfSrc"
[render-text]="true"
style="display: block;"
></pdf-viewer>
</ion-content>
component.ts
pdfSrc: string = '/pdf-test.pdf';