Hi Folks,
I need to download a PDF file from SharePoint Documents. Other files, .jpg, .xlsx. automatically downloading the file but PDF it opens another browser tab to view.
Is there a way to download it directly?
Hello @philifova
The closest to your requirement is the Download function.
Download("https://download_link.com/of_your_file.docx")
https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-download
But it only works if your users are using Mobile Power Apps and the Windows native Power App player.
Other than that you'll probably have to look at working on a more advanced component (PCFx) that could simulate a javascript that initiates a download. Here is the forum for it.
https://powerusers.microsoft.com/t5/Power-Apps-Pro-Dev-ISV/bd-p/pa_component_framework
✔️ | Just in case my response helped you solve your problem, please mark/accept this as a SOLUTION. This helps community members if they experience a similar issue in the future. |
🔗 | 🕸bistek.space 🐦 @cha_bistek 📺 @BisTekSpace |
This is due to a setting on your machine which is set to open .pdf files from the browser as the default action. This experience would not be the same for everyone using your app as it will depend on what their Operating system settings are for default file associations.
PDFs will by default try and open in Microsoft Edge, which is their associated program by default within Windows 8/10/11 - you will need to change this to something else if you wish to have the file to not open Edge. If you select the browser you are currently using it will open it within that going forward, but this change will only apply to your machine, everyone else will use whatever setting their PC has. I recommend using an actual PDF reader to make it browser-agnostic.