如何解决离子 PDFJS 无法匹配任何路由网址段:'lib/ui/index.html'
我正在尝试使用插件在我的 ionic 5 应用程序中打开 pdf npm i @ pdftron / pdfjs-express --save 但离子向我显示错误无法匹配任何路由。 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() {
}
}
解决方法
您在 https://github.com/PDFTron?q=angular 处使用过我们的任何角度示例吗?你可以克隆其中一个示例,看看它是如何实现的
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。