PDF not loading issue using URL

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.7.0

Detailed description of issue
When I am passing this url of my pdf file which is this https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf my viewer is not able to load that file and giving me the default page not found error from my theme. I tried both the ways of loading pdf file from URL as you can see in below code snippet.

Expected behaviour
The PDF provided from URL should be loaded fine because the pdf file is publicly accessible.

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

Link to document

Code snippet
WebViewer(
{
// path: ‘/webviewer/lib’,
initialDoc: ‘https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf’,
},
viewer.current
).then((instance) => {
// instance.UI.loadDocument(
// ‘https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf’,
// { filename: ‘sample.pdf’ }
// );
}

Hi anurag.kurmi,

Thank you for contacting pdf.js express forums,

I noticed that downloading the file and opening as a local file will load fine. In our separate demo, JavaScript PDF Viewer Demo

I get the following error when loading this url:
https://x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf

But when I try the resolved URL:
https://storage.googleapis.com/x9oo-fwyq-gkdq.n7.xano.io/vault/cIQOyqj4/aq1ODkTCEIHvsYY7wZn5nZNjVTo/qCt-vA../sample.pdf
Then it loads as expected:

As a side note, I also tried the 1st url in our sister product PDFTron WebViewer (PDFTron WebViewer Demo: JavaScript PDF Viewer Demo), and this is the error message:

Please use the domain ‘storage.googleapis.com’ because this is likely due to preventing unsafe url redirecting when loading the document.

Best Regards,
Kevin Kim


Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here