I have some Documents in a Sharepoint Online Doc library that I wanted to view in the PDF Control, but I keep getting the "PDF.js v1.4.139 (build: 56f5c3a)
Message: Invalid PDF structure"
error message, regardless if I try using the Sharepoint generated link or I type in a direct link to the PDF document.
Any ideas if connections to PDFs in SharepointOnline Document libraries are supported?
Using the PDF viewer in PowerApps would require the PDF URL generated from the "Get a link", and this works from my side.
If this don't work from your side, please first check your PowerApps studio, make sure update to version 2.0.570.
the URL for opening the PDF directly won't work here, which would result in the error you mentioned:
For more information regarding the PDF Viewer control, please see:
If you have any further questions, please post back.
Thank you for your response. i've checked the version of PowerApps Studio, it is 2.0.570
Looking at your screenshots, I noticed you used the "anonymous link" option, I tried that and it works, however the Docs I want to connect to are in a library where authentication is required.
I'm guessing that the PDF viewer does not open the document as it's unable to pass the User's credentials, is there a way of doing this?
Could you please explain a little about passing the User's credentials?
Based on what I know, if the URL could be accessed when building the app, then it should be no problem sharing the connection usage within PowerApps. See: Share App resources.
For the users would need access to the specific SharePoint Library, please make sure the permission is configured properly at the data source side.
If you have any further questions, please feel free to post back.
@v-micsh-msft thanks for responding.
I don't know if it's a bug or not, but the PDF viewer control does not open a PDF in a library where permissions are required. In my case it can't be the lack of permissions that's causing the problem as I have full admin access to the library in question. I can open the library in a browser access any document and it's the same account I've used to create the App as well as while testing the App.
If possible could you kindly test the same i.e. instead of trying to access a document that allows anonymous access, could you try accessing a document in a library where permissions are required?
I'm using SharepointOnline by the way.
Apologize for the late response.
PDF Viewer control currently don't support the Link which requires authentication.
Please see this thread for reference,
Reply from PA Staff irinak:
DF Viewer supports files that are accessible anonymously. It looks like in your case the link requires the user to be authenticated. A good way to test it is to open your IE in private mode and try open the PDF file through that link. If the browser prompts you to sign in to O365 then that link won't work in the PDF Viewer. Here is an article that talks about how to create anonymous guest links:
If you do require users to be authenticated to access the document, please add this feature request at https://aka.ms/powerapps-ideas
I've added it to the Ideas section, In my view this feature is quite useless if you cannot access documents in a library that requires authentication, most of the documents in a workplace are going to reside in Document Libraries that require authentication.
Here's the link to the post in the ideas sectio, if any one wants to up-vote it.
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
Learn how to build the business apps that you need.