web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PDF Viewer Not Downloa...
Power Apps
Unanswered

PDF Viewer Not Downloading all Content

(0) ShareShare
ReportReport
Posted on by 43
Hi, 
 
I am using pdfviwer to create a screen so users can download and/or print. Everything works fine except when downloading after Onselect of a button to run the code. It only downloads the first page, and when I open the pdf, the below message appears. 
 
 
The OnSelect is as such: 
Download(DownloadPDFFromPowerApps.Run({name:col_Audits.AuditName.Value & $"_SelfAudit.pdf",contentBytes:pdfContent}).path)
 
DownloadPDFFromPowerApps is the power automate connector. It creates the pdf into SharePoint. pdfContent is the variable used to create all the content. Creating the content works, everything is there, I can even open the pdf and print everything, but the download only saves the first page and produces the above error. 
 
The content does take time to load when viewing, so I wander if there's a way to slow down the download so that perhaps it'll all load. Any help will be greatly appreciated. 
 
 
Categories:
I have the same question (1)
  • Verified answer
    Ravi-Prajapati Profile Picture
    416 Super User 2025 Season 2 on at

    It sounds like your Power Automate flow is successfully generating the PDF and saving it to SharePoint, but the issue occurs when downloading it directly from Power Apps. Since the first page is downloading while the rest isn't, it could be a timing issue or an issue with how the Download() function is handling the file retrieval.

    Here are a few things to check and possible solutions:


    1. Ensure Power Automate Flow Completes Before Downloading

    If the PDF is still being written when Download() tries to fetch it, it might result in an incomplete file. Try introducing a delay before downloading the file by adding a Wait action in Power Automate.

    Steps to Add a Delay in Power Automate:

    1. After creating the PDF and saving it to SharePoint, insert a "Delay" action.
    2. Set it to 5-10 seconds to allow enough time for the file to be completely written.
    3. Then, return the file URL or content back to Power Apps.

    Alternatively, instead of a fixed delay, you can use a "Do Until" loop that checks whether the file size stops changing.


    2. Try Downloading from the SharePoint URL Instead

    Rather than passing the content directly from Power Automate, return the file URL from SharePoint and download it from there:

    Modify Power Automate to Return URL:

    • Instead of returning contentBytes, return the SharePoint file path.
    • Update the Power Apps Download() function to fetch the file using the URL.
    Download("https://yoursharepointsite/Shared Documents/" & col_Audits.AuditName.Value & "_SelfAudit.pdf")

    This ensures that Power Apps downloads the fully created file.


    3. Verify the File Content Type in Power Automate

    Ensure that Power Automate is returning the file in the correct format. In the "Create File" step:

    • Set Content Type to "application/pdf" explicitly.
    • Confirm that contentBytes is correctly passed.

    4. Check If the File is Corrupted

    Since you're seeing an error message when opening the downloaded file, test by:

    • Manually downloading the PDF from SharePoint.
    • If it works fine, then the issue is in how Power Apps retrieves it.
    • If it is corrupted from SharePoint itself, the issue is in Power Automate's PDF generation.

    5. Use Power Automate’s "Get File Content" Action Instead of contentBytes

    If contentBytes isn't fully loading, modify your Power Automate flow:

    • Instead of returning contentBytes directly, add a "Get File Content" action after the file is created.
    • Use that output to send back to Power Apps.
  • PowerAutomatic Profile Picture
    43 on at
    Thank you Ravi!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard