Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4bvrLtBPuSnH60mSM7rrVU
Power Apps - Building Power Apps
Answered

How do I create a PDF on OneDrive of a Screen in Power Apps?

Like (0) ShareShare
ReportReport
Posted on 29 Apr 2024 19:16:18 by 930

The Goal

Create a PDF file in a folder on OneDrive.

 

The Attempts

The punch line here is that no data is being recorded in Power Automate.

 

I have

 - enabled "PDF function" in "Upcoming features", "Experimental" 

 - Created a Flow (if this can be done wholly in Power Fx, that is great, too)

    * The precise Flow seems unimportant right now, as I can't seem to pass any information to Flow

 - Added this code to my Power App, Canvas App

 

SavePDFToOneDrive.Run({PDFContent:PDF('Quick Look')})

 

From my Flow, in the Power Apps (v2) trigger, I don't get any data (Content-Length: "0",):

BenDonahue_0-1714411094095.png

The Result

No data is received in the Power Automate Flow

 

The Ask

How can I get a PDF of a screen in Power Apps saved to OneDrive

 

The Thanks

Thank you for your assistance with this. This has been a maddening experience, and I am very much looking forward to a successful conclusion to this, so, again, thank you!! You rock!!! 🤘

Categories:
  • Verified answer
    BenDonahue Profile Picture
    930 on 03 Jul 2024 at 16:09:27
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    The simple solution involves leveraging graph, like so:

     

     

    Set(_now, Text(Now(),"yyyy-mm-dd_hhmm-ss"));
    Navigate('Completion Tracker',ScreenTransition.Cover);
    Set(
     strPDFCompletionTrackerTTL,
     Concatenate(
     "CompletionTracker_",
     _now,
     ".pdf"
     )
    );
    Set(pdfCompletionTracker, PDF('Completion Tracker', {Orientation: "Landscape"}));
    
    Office365Groups.HttpRequest(
     $"https://graph.microsoft.us/v1.0/me/drive/root:/" & strPDFCompletionTrackerTTL & ":/content",
     "PUT",
     pdfCompletionTracker
    );

     

     

    A more abstracted version of the graph call is:

     

     

    Office365Groups.HttpRequest(
     $"https://graph.microsoft.us/v1.0/me/drive/root:/" & <PDFFileTitle> & ":/content",
     "PUT",
     <PDF Content>
    );​

     

    I imagine this will help a lot of folk; I certainly hope so.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 21 May 2024 at 10:32:40
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    Hi @BenDonahue,

     

    Indeed it looks like that. 

     

    May I ask if you tried using this guide in the official documentation of the function to get things to work? Work with the PDF function (experimental) - Power Apps | Microsoft Learn

  • BenDonahue Profile Picture
    930 on 20 May 2024 at 15:39:15
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    @BCBuizer ,

    After switching up the data transfer from File type to Text type, I places a Compose right after the trigger to report on the data being transferred, and this is what I got:

    appres://blobmanager/4c36f93356c04f7e8431b42706c49db0/4

     This might be real promising; is this referencing a location where the PDF data in Text form can be found?

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 02 May 2024 at 15:28:49
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    Hi @BenDonahue ,

     

    I was about to write a formula to test when I noticed you are trying to pass a record to Power Automate and I think the issue is there. Can you please try with the below formula where the output of the PDF function is passed to Power Automate as a text?

     

    SavePDFToOneDrive.Run(PDF('Quick Look'))

     

  • BenDonahue Profile Picture
    930 on 02 May 2024 at 11:45:11
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    And there's the rub; choosing a File type to receive in Power Apps, nothing is being received ion the Run() call.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 01 May 2024 at 18:34:45
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    Hi @BenDonahue ,

     

    If you can capture the file content in a variable, the PDF function should indeed not be the issue. Next step in testing is to try and pass the value of the variable to Power Automate. 

  • BenDonahue Profile Picture
    930 on 01 May 2024 at 10:44:41
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    Hello @BCBuizer,

     

    First, thank you for your time and help.

     

    Yes, "Quick Look" is a screen name. Once I save the PDF to a variable, I can see the PDF using the PDV viewer control, so I know that part is working. This issue, I believe, is handing that data over to Power Automate; I could be mistaken.

  • BCBuizer Profile Picture
    22,070 Super User 2025 Season 1 on 29 Apr 2024 at 20:39:04
    Re: How do I create a PDF on OneDrive of a Screen in Power Apps?

    Hi @BenDonahue ,

     

    To get it out of the way: As you noticed the PDF function is an experimental feature which may break / be removed without prior notice and should hence not be used in production.

     

    Can you please confirm 'Quick look' is the name of either a Vertical Gallery, Vertical Layout Container, Horizontal Layout Container, Container, or Screen? These are the only supported objects: PDF function (experimental) - Power Platform | Microsoft Learn

     

    For testing, you could try saving the output of the function to a variable and see how that comes out?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 89 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 60

#3
stampcoin Profile Picture

stampcoin 48

Overall leaderboard