# Webviewer initialization error

**URL:** <https://pdfjs.community/t/webviewer-initialization-error/173>\
**Category:** Technical Support\
**Created:** [July 31, 2020, 11:50am UTC](https://pdfjs.community/t/webviewer-initialization-error/173 "2020-07-31T11:50:08Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![kallol.baidya](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@kallol.baidya](https://pdfjs.community/u/kallol.baidya)\
**Post date:** [July 31, 2020, 11:50am UTC](https://pdfjs.community/t/webviewer-initialization-error/173/1 "2020-07-31T11:50:09Z")

</div>

Hi,

I am trying to integrate PDF.JS Express in salessforce lightning web component. I am facing the issue below. However I can the PDF is getting rendered, but the instance promise is not getting resolved.  
**Detailed description of issue**  
In browser console log , it throws error  
“ **Viewer isn’t instantiated correctly. It could be caused by the ‘path’ option in the WebViewer constructor not being defined correctly. The ‘path’ option should be relative to the HTML file you’re loading the script on and the lib folder needs to be publicly accessible** ”

shows warning - “ **Viewer is on a different domain, the promise from WebViewer function is rejected and API functions will not work because of cross domain permissions.** ”

**Expected behaviour**  
No errors should be thrown at the time of intialization, so that the instance gets available in promise. and use annotations later on.

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

**Code snippet**  
const viewElement = this.template.querySelector(".viewer");

```
        const viewer = WebViewer(

          {

            path: myObj.libUrl,

            config: myfilesUrl + "/config.js",

            initialDoc: url,

            fullAPI: myObj.fullAPI,

            enableAnnotations: true,

            enableMeasurement: true,

            disabledElements: ["signatureToolButton"]

          },

          viewElement

        ).then((instance) => {

          const { docViewer, annotManager } = instance;

          docViewer.on("documentLoaded", () => {

            docViewer

              .getDocument()

              .removePages([1])

              .then((res) => {

                console.log(res);

              });

          });

        });
```

---

_[View the full topic](https://pdfjs.community/t/webviewer-initialization-error/173)._
