Custom UI Example repo on Github Doesn't Work

Which product are you using?
PDF.js Express Plus

PDF.js Express Version

Tried 8.4.0 and 8.7.4

Detailed description of issue
I am trying to run the sample code from your Github repo and the code just doesn’t work! The page shows with simple buttons but the document never loads and I see errors in the browser console saying:

PDFJSDocumentType.js:2749 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'addSearchListener')

at trackAnnotationEvents (PDFJSDocumentType.js:2749:359)
at PDFJSDocumentType.js:2759:358
trackAnnotationEvents @ PDFJSDocumentType.js:2749
(anonymous) @ PDFJSDocumentType.js:2759
Promise.then (async)
ja @ webviewer-core.min.js:188
z @ webviewer-core.min.js:188
Promise.then (async)
ja @ webviewer-core.min.js:188
(anonymous) @ webviewer-core.min.js:188
ca @ webviewer-core.min.js:188
ba.qx @ webviewer-core.min.js:297
(anonymous) @ main.js?t=1706031856893:34

Expected behaviour
The document to load and show on the page without errors

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

Link to document
Not relevant / Happens with all documents

Code snippet

I was trying to reply on the previous discussion to continue on the same topic but your system will not allow more than 3 replies…? So I had to open this new topic.

I’m just trying to make your own Custom UI code to work. It is unchanged and simply doesn’t work. :frowning:

Please help :pray:

Hi there,

I was able to get the custom UI repo to work on my end.

What version of node are you using? I am using v16.20.0 and npm v9.8.1. Please try deleting the node modules and package-lock.json, clearing cache and then reinstall.

Best Regards,


Thank you very much for your help!

I did more troubleshooting and it looks like my npm install was pulling the newer versions and these are the ones that don’t work.

Only 8.4.0 works - but none of the newer ones do.

The newer versions, 8.7.4, 8.7.0 and I even tried 8.6.0. None of those versions load the document.

Can you please try the newer versions? I would think a lot has change since 2 years ago when the 8.4.0 package was released

Thank you!

Hi there,

Glad that worked for you. Yes, the new versions do not seem to work with the custom ui. I have added this issue to our backlog. Thank you.

Best Regards,

1 Like