PDF JS Express integration in chrome extension

Which product are you using?

PDF.js Express Viewer
PDF.js Express Version

“UI version”: “8.7.0”,
“Core version”: “8.7.4”,
“webviewer.min.js”: “8.7.4”,
“Build”: “Ni8xNi8yMDIzfDhhZjQyYTgwOTU=”,
“WebViewer Server”: false,
“Full API”: false

Detailed description of issue
I have a chrome extension in an iframe, and I want to load the pdf viewer in sidebar
We render react app in a extension which is a sidebar basically

The issue is, how can i set up license key which would support this behavior? I tried with chrome-extension//unique id it did not work, how can i overcome this issue?

Expected behaviour
A user can view pdf in sidebar at any given moment at any website.

Does your issue happen with every document, or just one?
We have a web app as well it works in fine there but we need this to integrate with our extension as well

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

Code snippet

export const PDFViewer = ({url, name, size}: IPDFViewer) => {
  const viewer = useRef(null);
  useEffect(() => {
    const initializeWebViewer = async (blob: Blob) => {
      try {
        const instance = await WebViewer(
            path: '/',
            licenseKey: 'license-key',
        blob &&
          (await instance.UI.loadDocument(blob, {
            filename: name,
        // stops inline executing of js
      } catch (e) {

    const loadPdf = async () => {
      const file = await fetchAsset(url);


  }, [url]);
  return <Box ref={viewer} {...sizes[size]} w='100%' flexShrink={0} />;

Hello usman,

The license key is tied to a domain, therefore if its running on the domain it should be fine.
You can read more here: PDF.js Express Viewer Download & Integration | Documentation

Best regards,

Hi @tgordon
The chrome extension can be opened in any domain (google,youtube,etc). I cant create license keys for all. Is there any work around for such cases?

Hello usman,

The license has to be tied to a specific domain, wherever your server is that is hosting the files should be the domain you’re using.

Best regards,