📄 PDF Viewer Component for Angular
Since FindController.executeCommand
is deprecated, you should now use eventBus
to do search. Example:
@ViewChild(PdfViewerComponent) private pdfComponent: PdfViewerComponent;
search(stringToSearch: string) {
this.pdfComponent.eventBus.dispatch('find', {
query: stringToSearch, type: 'again', caseSensitive: false, findPrevious: undefined, highlightAll: true, phraseSearch: true
});
}
Now you need to specify how much space pdf-viewer
element should take by using CSS, so either set width
and height
, use flexbox
or use something like positioning
.
<pdf-viewer [src]="src" [original-size]="false" style="width: 400px; height: 500px"></pdf-viewer>
<pdf-viewer [src]="src" [original-size]="false" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0"></pdf-viewer>