Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? No
Please give a brief summary of your issue:
Integrating Webviewer with SharePoint online throwing cross domain permissions issue
Please describe your issue and provide steps to reproduce it:
I am following below document to setup Webviewer with SharePoint online
I have followed the steps exactly as mentioned in the document but my webviewer does not go into success call and throws error as “WebViewer function is rejected and API functions will not work because of cross domain permissions. See PDFTron for more information.”
I have uploaded the Webviewer files in the same site (domain). I also tried to deploy the app but error continues.
Also when I run the sample spfx solution locally, it does not show the index.aspx page instead downloads it.
Please provide a link to a minimal sample where the issue is reproducible:
WebViewer(({
path: ‘/_catalogs/masterpage/pdftron/lib’,
uiPath: ‘./ui/index.aspx’,
enableFilePicker: true,
initialDoc:‘I enter document URL here’
} as any), this.domElement).then(function(instance) {
console.log(“I am inn”)
}).catch(e => {
console.log(“Error”) // Here I get the cross domain error
});
Just be aware that to use the APIs you will need to use a “config file” because of cross origin restrictions. You can find more information about this here PDFTron
I am trying to use the code in SPFx webpart and not in the Add-ins and have uploaded the webviewer sites in the same site collection where I am trying to add the webpart.
Logically they should be one same domain.
I tried to follow the exact same steps in Integration with PDFTron article PDFTron but my results are different than this article.
Am I missing any specific step in order to make it work without using config file?
Using config file will not allow us to use PDFTron to its full potential as we would like to reuse our SPFx webparts. Could you please help me to recommend any other options.