I'm updating my Angular App to Angular 19 and with that I had to switch vom ng2-pdfjs-viewer to @kariudo/ng2-pdfjs-viewer because the original one doesn't support Angular 19 yet.
This is my code:
<ng2-pdfjs-viewer [pdfSrc]="source"
[download]="false"
[fullScreen]="false"
[find]="false"
[viewBookmark]="false"
[openFile]="false"
[print]="false"
[zoom]="'page-width'"
[useOnlyCssZoom]="true"
[page]="page"
></ng2-pdfjs-viewer>
The Viewer is working and is showing the right PDF, but somehow the Options I set, like disabling the download button, are not working.
What am I doing wrong?
I'm updating my Angular App to Angular 19 and with that I had to switch vom ng2-pdfjs-viewer to @kariudo/ng2-pdfjs-viewer because the original one doesn't support Angular 19 yet.
This is my code:
<ng2-pdfjs-viewer [pdfSrc]="source"
[download]="false"
[fullScreen]="false"
[find]="false"
[viewBookmark]="false"
[openFile]="false"
[print]="false"
[zoom]="'page-width'"
[useOnlyCssZoom]="true"
[page]="page"
></ng2-pdfjs-viewer>
The Viewer is working and is showing the right PDF, but somehow the Options I set, like disabling the download button, are not working.
What am I doing wrong?
I had the same problem. It seems that the options are not being passed on correctly/completely. I already tried it with the older version 17.0.21 of @kariudo/ng2-pdfjs-viewer and also the example from the GitHub repo didn't work.
So I used this rather less nice workaround: workAroundDisableButtons should be called when the PDF is loaded and rendered.
//.html
<ng2-pdfjs-viewer [pdfSrc]="url" #viewer></ng2-pdfjs-viewer>
//.ts
@ViewChild('viewer') pdfViewer: PdfJsViewerComponent;
get viewerAppconfig() {
return this.pdfViewer.PDFViewerApplication.appConfig;
}
workAroundDisableButtons() {
(this.viewerAppconfig.secondaryToolbar.printButton as HTMLElement).style.display = 'none';
(this.viewerAppconfig.secondaryToolbar.downloadButton as HTMLElement).style.display = 'none';
(this.viewerAppconfig.secondaryToolbar.openFileButton as HTMLElement).style.display = 'none';
(this.viewerAppconfig.secondaryToolbar.presentationModeButton as HTMLElement).style.display = 'none';
}