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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to save a PDF Gene...
Power Apps
Answered

How to save a PDF Generated with the Experimental PDF() Function in Power Apps

(0) ShareShare
ReportReport
Posted on by 27
Hi Everyone, 
 
I'm experimenting with the PDF() function in Power Apps. I can successfully generate a PDF from a container. But I'm struggling with the next step: saving the generated PDF. I think I've used every loophole in AI to get the content of the PDF to Power Automate (both classic and V2 connections). I keep ending up with de blob-adress whatever I try.  
 
I even tried things like this: Set(mijnPDFBase64; Mid(JSON(mijnPDF; JSONFormat.IncludeBinaryData); Find("base64,"; JSON(mijnPDF; JSONFormat.IncludeBinaryData)) + 7; Len(JSON(mijnPDF; JSONFormat.IncludeBinaryData)) ));;
(I'm in the Netherlands, that's why the syntax is slightly different.)
 
I'm looking for the exact formula in PowerApps to call PowerAutomate (something like:  
'SavePDF'.Run(
    {        
       file: {
            name: "myPDF.pdf";
            contentBytes: PDF(containerPDF)
        }              
    }
)
 
And for the way this information must be received in PowerAutomate. Any help greatly appreciated.
 
Gert
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    If you do this
    With(
       {
          _PDF: With(
             {
                _JSON: JSON(
                   PDF(YourPDFTarget),
                   JSONFormat.IncludeBinaryData
                )
             },
             Mid(
                _JSON,
                Find(
                   ",",
                   _JSON
                ) + 1,
                Len(_JSON) - Find(
                   ",",
                   _JSON
                ) - 1
             )
          )
       },
       SavePDF.Run(
          _PDF,
          "myPDF.PDF"
       )
    )
    and your Flow looks like this (example adding file to SharePoint Library), it should work
     
     
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
     
  • GV-21111608-0 Profile Picture
    27 on at
    Thank you for your suggestion. The PowerApp says on the run command: Invalid argument (Text). Record expected.
  • Verified answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    HI @GV-21111608-0,
    Adding to @WarrenBelz response, there is a easy way to do :
    i am showing a sample flow, which i generally use.

    create a power automate trigger like:
    then use create file action (sample processing of the file):
     
    expressions in file name :
    @{formatdatetime(utcNow(),'yyyy_MM_dd_hh_mm_ss')}_@{triggerBody()?['file']?['name']}.pdf   (u can directly paste this or use dynamic content)

    expressions in file content :
    @{triggerBody()?['file']?['contentBytes']}
     
    then use Create share link :
    in the file parameter use the id from previous step (dynamic content). - adjust the scope and link type as per requirment.

    and finally add Respond to a Power App or flow action.   (here i added the web url generated from the previous step (dynamic content)

    full flow pic:
    Now from Power Apps side:

    use this power fx inside a button:
     
    Set(
        pdf_file,
        PDF(Screen1)           // sample pdf generation
    );
    Launch($"{
        AttachementTest.Run(                      //dummy flow name replace with original name
            {
                file: {
                    name: "new_pdf",
                    contentBytes: pdf_file
                }
            }
        ).weblink}?download=1"
    )

     
  • Verified answer
    GV-21111608-0 Profile Picture
    27 on at
    This call finally did the trick. No need for base64ToBinary any more. This seems to be a recent update.
     
       MakePDF.Run(
            {
                contentBytes: PDF(cntPDF; {ExpandContainers: true;
                DPI: 200});
                name: "temp.pdf"
            };
            Concatenate(
                "Filename - ";
                Text(Now(); "yyyy-mm-dd hh:mm:ss");
                ".pdf"
            )
        )
     
    And just two steps in PowerAutomate as described by PowerPlatform 1919: When PowerApps calls a flow and Create file. 
    Since the filename contains an extra variable (not shown in this example) passed from the PowrApp I create the filename in PowerApps and pass it on to 
    Unfortunately the parameter web URL does not seem to be available. We can do without it. 
     
    Thanks for your support. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard