离子 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() {

}

}

enter image description here

解决方法

您在 https://github.com/PDFTron?q=angular 处使用过我们的任何角度示例吗?你可以克隆其中一个示例,看看它是如何实现的