Webviewer Integration with SharePoint issues

WebViewer Version:8.2.0

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
});

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:

Hello pdftronpoc,

Welcome to the community!

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

Please also take a look at this documentation on Sharepoint add-ons here: Authorization and authentication of SharePoint Add-ins | Microsoft Docs

Let me know if this works for you

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Hello Tyler,

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.

Hello pdftronpoc,

I’m not too familiar with SharePoint, however heres a couple of questions or suggestions to fix this issue:

  1. Have you added the tenant domain URL and your local workbench URL to the Allowed Origin list?
  2. Are you loading the initial document from another domain?

Best Regards,
Tyler Gordon
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com