How to load different pdf on pdfjs express viewer on passing url through button click

PDF.js Express Version

Detailed description of issue
How to load different pdf on pdfjs express viewer on passing S3 bucket url through button click.I want to change the pdf inside the viewer as i click on any file present on my screen.

Expected behaviour

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

Hi!

You can use the loadDocument API on the WebViewer instance to open documents. You can pass in the URL directly to this api, as long as the URL is publicly accessible.

WebViewer({...}, ele).then(instance => {

    instance.loadDocument(path_to_your_s3_file);

})

You could move the load document call into the buttons onclick handler.

Thanks!
Logan