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

**URL:** <https://pdfjs.community/t/how-to-load-different-pdf-on-pdfjs-express-viewer-on-passing-url-through-button-click/320>\
**Category:** Technical Support\
**Created:** [October 7, 2020, 9:57am UTC](https://pdfjs.community/t/how-to-load-different-pdf-on-pdfjs-express-viewer-on-passing-url-through-button-click/320 "2020-10-07T09:57:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [October 7, 2020, 2:45pm UTC](https://pdfjs.community/t/how-to-load-different-pdf-on-pdfjs-express-viewer-on-passing-url-through-button-click/320/2 "2020-10-07T14:45:09Z")

</div>

Hi!

You can use the [`loadDocument`](https://pdfjs.express/api/WebViewerInstance.html#loadDocument__anchor) 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.

```javascript
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

---

_[View the full topic](https://pdfjs.community/t/how-to-load-different-pdf-on-pdfjs-express-viewer-on-passing-url-through-button-click/320)._
