Problem with initialization viewer

PDF.js Express Version
Probably 7.3.3. I’m not sure, because I cannot initialize viewer so I don’t get this info in console.

Detailed description of issue
I get “Failed to load resource: the server responded with a status of 404” when I run my application.
I assume that there’s some problems with accessing index.html with viewer.

Full error message:

Failed to load resource: the server responded with a status of 404 (Not Found)

Expected behaviour
Properly rendered viewer :slight_smile:

Does your issue happen with every document, or just one?
I tried document from url, and a few documents from my local files. Problem is the same for both cases.

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

Code snippet
Code which i use to initialize viewer:

<script src="~/lib/pdfexpress/lib/webviewer.min.js"></script>

                <div id="express_viewer"></div>

                const viewer = document.getElementById("express_viewer");

                    path: '~/lib/pdfexpress/lib',
                  licenseKey: 'my license code here',
                  initialDoc: ''
                }, viewer).then(instance => {

                    const { docViewer } = instance;
                    docViewer.on('documentLoaded', onDocumentLoaded);

                  // Vanilla JS
                    const onReady = instance => {
                      // Executed when the viewer is ready
                      // NOTE: Document is not loaded yet


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:


Hey there, this means that the path to your resources is incorrect. Please make sure that path: '~/lib/pdfexpress/lib', is correct. Also, try removing the ~ and using an absolute path.


Hey there,

“~” is equivalent of resource folder in my project.

I tried to change it to absolute path, but I have another error message.

This is my project structure:


I used absolute path and now I get this error:


I also noticed there’s no problems with webviewer.min.js file, so I assume that ‘~/lib/pdfexpress/lib’ path is correct.


Can you help me somehow?

@Logan can you help me?
I still didn’t manage to do that.

Hi there,

This is very tough for me to debug as it is an issue with your environment. Are you able to send me a sample project where this is reproducable?


Hello @Logan

How can I sent you sample project?

Hi there!

The best way would be to zip up a minimal project where you can reproduce the problem.

Are you able to access {your_local_url}/lib/pdfexpress/lib/ui/index.html directly in your browser? At the end of the day this is an issue with your local environment and it seems like either ~/lib/pdfexpress/lib is incorrect, or your server is not serving /lib/pdfexpress/lib/ui/index.html correctly.