Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing multiple pdf's with ngx-extended-pdf-viewer

I was messing around with the ngx-extended-pdf-viewer and got a feel for what it does BUT I was curious as to whether it was flexible enough to let a user switch between pdf's?

As it stands this only shows one pdf but I was curious to if it was possible to switch to another pdf with different settings?

<ngx-extended-pdf-viewer
    [src]="'assets/BootsFaces_Deep_Dive_1.0.pdf'"
    backgroundColor="#e8e8ef"
    [mobileZoom]="mobileFriendlyZoom"
    [showZoomButtons]="true"
    [showSidebarButton]="showSidebar"
    [useBrowserLocale]="true"
    [showSidebarOnLoad]="true"
    [(zoom)]="zoom"
    [height]="height"
    [handTool]="handTool"
    [page]="page"
    [filenameForDownload]="filenameForDownload"
    (pagesLoaded)="onPagesLoaded($event)"
    [(spread)]="spread"
    [language]="language"
    [showPresentationModeButton]="true">
</ngx-extended-pdf-viewer>
like image 376
CJ84 Avatar asked Oct 17 '25 18:10

CJ84


1 Answers

ngx-extended-pdf-author here. Yeah, sure, <ngx-extended-pdf-viewer> can display multiple PDF files over time. The attribute [src] reacts to changes. I've published a showcase example: https://www.pdfviewer.net/multiple-documents

Actually, I've specifically created the library to display a plethora of PDF files during a long, long working shift without restarting the Angular client. I guess that's several hundred, more likely several thousand PDFs before closing the browser. Mind you, my original customer is still using an old version: in the mean time both the pdf.js team and I have managed to fix several memory leaks.

However, there are limits. It's not possible to display two PDF files on the same page. If you need that, you're better of with an iFrame solution, such as ng2-pdfjs-viewer. BTW, that's a fine library, too.

As for the "different settings" bit: every attribute I've documented with square brackets, such as [src] or [(page)], listens to changes. As soon as you change the pageNumber variable in your TypeScript code, the PDF viewer jumps that that page.

If you've still got questions or if you encounter bugs, don't hesitate to tell me.

like image 72
Stephan Rauh Avatar answered Oct 20 '25 07:10

Stephan Rauh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!