# Pdf js viewer throwing error on Firefox

**URL:** <https://pdfjs.community/t/pdf-js-viewer-throwing-error-on-firefox/429>\
**Category:** Technical Support\
**Created:** [December 29, 2020, 12:00pm UTC](https://pdfjs.community/t/pdf-js-viewer-throwing-error-on-firefox/429 "2020-12-29T12:00:56Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![himani.sharma](https://avatars.discourse-cdn.com/v4/letter/h/e47774/32.png) [@himani.sharma](https://pdfjs.community/u/himani.sharma)\
**Post date:** [January 5, 2021, 11:38am UTC](https://pdfjs.community/t/pdf-js-viewer-throwing-error-on-firefox/429/3 "2021-01-05T11:38:15Z")

</div>

Thanks Logan !

Please find the attached code to load the Webviewer instance.

```javascript
wvInstance;
  ngOnInit() {
    this.wvDocumentLoadedHandler = this.wvDocumentLoadedHandler.bind(this);
  
    this.detailsStepService.hasSubmittalId.subscribe(res => {
      this.submittalId = res;
    });
  }

  wvDocumentLoadedHandler(): void {
    const docViewer = this.wvInstance;
    const annotManager = this.wvInstance.annotManager;
    const { Annotations } = this.wvInstance;
    this.wvInstance.closeElements(['loadingModal']);
  }
  getDataById(info, id, index, instance?:any) {
    console.log('instance 2', instance);
    this.wvInstance = instance;
    this.selectIndex = index;
    console.log(info)
    this.pdf_url = info
    this.fileId = id
    console.log(this.fileId)
    this.wvInstance.openElements(['loadingModal']);
    this.wvInstance.docViewer.loadDocument(info)
    if (this.files.length > 1 && index != 0) {
      console.log('files greater than 1');
      this.sendForOCr();
    }
  }
  async ngAfterViewInit(): Promise<void> {
    WebViewer({
      licenseKey: 'u4Utg1NNWOrQZIX32Rxu',
      disableFlattenedAnnotations: true,
      path: '../../wv-resources/lib',
      config: '../../wv-resources/lib/ui/config/file.js', // relative to your HTML file
      disabledElements: [
        'selectToolButton', 'toolbarGroup-Edit', 'toolsHeader', 'searchButton', 'header',
        'panToolButton', 'toggleNotesButton', 'notesPanel', 'menuButton', 'highlightToolGroupButton', 'underlineToolGroupButton', 'strikeoutToolGroupButton', 'stickyToolGroupButton', 'freeHandToolGroupButton',
        'toolsOverlay', 'viewControlsButton', 'leftPanelButton', 'toolbarGroup-Insert', 'toolbarGroup-Shapes', 'squigglyToolGroupButton', 'freeTextToolGroupButton',
      ],
     
    }, this.viewer.nativeElement).then(instance => {
      console.log('instance 1', instance);
      this.wvInstance = instance;
    
      const tempSubmittalId = this.route.snapshot.queryParams['submittal'];
      if (tempSubmittalId) {
        this.submittalId = tempSubmittalId;
        this.detailsStepService.changeSubmittalId(tempSubmittalId);
        this.initiatePDFeditor(instance);
      }

      const utils = new ExpressUtils({
        serverKey: '49EzA6YczS1pfUG7ZYZy',
        clientKey: '0U7UA9kWPkFSfX3iQNB5'
      })

      const { Annotations, Tools, annotManager, docViewer } = instance;
      // set pdf to full width of viewer
      instance.setFitMode(instance.FitMode.FitWidth);
)}
}

  initiatePDFeditor(instance?:any) {
    this.fileUploadService.getDataById(this.submittalId).subscribe(res => {
      this.files = res;

      for (let file of this.files) {
        file["active"] = false;
      }

      if (this.files.length > 0) {
        this.getDataById(this.files[0].file_info, this.files[0].id, 0, instance);
      }
    }, err => {
      const error = err.error || 'Server Error';
      this.openSnackBar(error);
    });
  }

```

---

_[View the full topic](https://pdfjs.community/t/pdf-js-viewer-throwing-error-on-firefox/429)._
