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

Community site session details

Session Id :
Power Apps - Power Apps Experimental Features
Answered

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

(0) ShareShare
ReportReport
Posted on by 2
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
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    152,667 Most Valuable Professional on at
    How to save a PDF Generated with the Experimental PDF() Function in Power Apps
    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
    2 on at
    How to save a PDF Generated with the Experimental PDF() Function in Power Apps
    Thank you for your suggestion. The PowerApp says on the run command: Invalid argument (Text). Record expected.
  • Suggested answer
    Power Platform 1919 Profile Picture
    1,660 on at
    How to save a PDF Generated with the Experimental PDF() Function in Power Apps
    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"
    )

     

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

Coming soon: forum hierarchy changes

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

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 724 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
SebS Profile Picture

SebS 239 Moderator

Last 30 days Overall leaderboard

Featured topics