Got this error...
Hi Harlin,
Did you try to investigate yourself at all? I know nothing about this component, but if I type "PDF.js f" in Google, it automatically offers the suggestion "file origin does not match viewer's", and when searching for that there's a lot of info.
Yes I did, but I am not Javascript programmer.
All answers I got from google was to comment out that logic that check the file origin in the minified javascript.
I don't know how to do that.
Hello Harlin,
I'll see if I can put a configuration allowing for this in the component.
As soon as I'm able to do that, I'll let you know here.
Cheers
P.S. probably today I'll have news on this.
Thanks a lot.
I was investigating the issue. I remember that we have a HostsList in the component.It is meant to defined the hosts that are allowed to see the PDF, if the PDF is not in the application's host.
So, if both application's and pdf file's hosts are under control, you can add your application host www.yourapplication.com to this list (when calling the Viewer screen, through the HostsList parameter).
Unfortunatelly, this will work ONLY if the PDF source has your host marked as a permitted requester (through the header Access-Control-Allow-Origin).
So, if you do not control the host were the PDF is installed nor the owners whitelist your host, the browser will not allow you to fetch the resource.
This is a Browser's security feature that I think you can't workaround.
Cheers.
I've tried the HostsList before, but it still didn't work.
Please elaborate on the header Access-Control-Allow-Origin.
I know I can add the header using HttpRequestHandler's AddHeader action.
But what value should I put in there.
This header must be placed in the URL of the PDF, not in your application.
It is not possible to download, through your application, any resource from a domain other than the domain your application is, unless the domain where the resource is say (through that header in the response) that your domain is allowed.
Ok, I got it now.
I will notify the owner of pdf page.
What value should be put in the header?
Thanks.
Here you see syntax and examples: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
Than, in the HostsList property, you put your domain.