The promise from WebViewer function is rejected

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version

Detailed description of issue
@Logan,Hi Mr. Logan, I saw the demo case and it was great.But I ran into some problems when I tried. I registered lisenceKey, and it shows that lisenceKey binding is correct in offline test. However, under this domain name, an error occurred. I changed the cORS Settings for the document server, but it still didn’t work. My config.js doesn’t work either.

Expected behaviour
{Provide a screenshot or description of the expected behaviour}

Does your issue happen with every document, or just one?
every document

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

Code snippet
{Provide a relevant code snippet}
image

 useEffect(() => {
    if (ereportInfo) {
      WebViewer(
        {
          path: `${process.env.REACT_APP_Path}/lib/webviewer`,
          licenseKey: 'xxxxxx',
          initialDoc: ereportInfo.link_path,
          config: `${process.env.REACT_APP_Path}/config.js`
        },
        viewer.current
      )
    }
  }, [ereportInfo])


image

instance.UI.addEventListener(instance.UI.Events.VIEWER_LOADED, () => {
  instance.setFitMode(instance.FitMode.FitWidth)
})

localhost:

online:




Anything I am potentially missing?

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hey there!

Can you try updating to the latest version and letting me know if it fixes it? We had some timing issues in 8.1 that may be the issue here.

Let me know,

Thanks,
Logan

After I updated the version to 8.2, the problem was solved , Thanks a million! :+1:

1 Like