【发布时间】:2021-07-05 21:24:39
【问题描述】:
我正在尝试使用该插件在我的 ionic 5 应用程序中打开一个 pdf npm i @ pdftron / pdfjs-express --save 但 ionic 向我显示错误无法匹配任何路线。 URL 段:'lib/ui/index.html' 请问如何纠正这个错误? 我的代码:
app.component.html
<div class="page">
<div class="header">Angular sample</div>
<div #viewer class="viewer"></div>
</div>
app.component.ts
import { Component, ViewChild, OnInit, ElementRef, AfterViewInit } from '@angular/core';
import WebViewer from '@pdftron/pdfjs-express';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit, AfterViewInit {
@ViewChild('viewer', { static: false }) viewer: ElementRef;
wvInstance: any;
ngAfterViewInit(): void {
WebViewer({
path: '../lib',
initialDoc: '../files/webviewer-demo-annotated.pdf'
}, this.viewer.nativeElement).then(instance => {
this.wvInstance = instance;
})
}
ngOnInit() {
}
}
【问题讨论】:
标签: pdf ionic-framework pdfjs pdftron