WebViewer path as AWS public link

Hi, I tried to give a web viewer path as an AWS link but the instance shows an error.

error message: viewer is on a different domain, the promise from webviewer function is rejected and api functions will not work because of cross domain permissions. see https://www.pdftron.com/kb_cross_origin for more information.

WebViewer(
{
path: ‘https://esquiretek-public-assets.s3.us-west-1.amazonaws.com/library/lib/’,
initialDoc: ‘https://pdftron.s3.amazonaws.com/downloads/pl/webviewer-demo.pdf’,
fullAPI: true,
disableLogs: true
},
W_container.current
).then((instance) => { //instance undefined
console.log(instance)
})

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:

Hi Parthi
Thanks for contacting us for support.
If you are in control of s3 bucket, you need to allow http://127.0.0.1 to access the resource:
https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors.html

Edit: The browser is just complying with the security standard for CORS, here’s a general overview if you never encountered this issue before:

Jack

Hi, Jack thanks for your support.

I’m already using the public access s3 bucket link in webviewer path and enabled cors also but I’m getting the same error in Catch Exception please check below image

please check the below image for the network.

Hi Parthi
So because the dependencies are hosted on a separate domain, you need to call WebViewer APIs from a Config file hosted on the same domain. For more information, see:

Jack

Hi Jack, I’m using react framework unfortunately in my project there is no public folder access.

so, Core.setLocalWorkerPath(’…/core’); this will not work

Hi Parthi
There should be public folder in your react. I think it’s better you could send me your code is that I can help you for that
Jack