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 / Using Launch() to open...
Power Apps
Answered

Using Launch() to open a Base64 PDF in a new browser tab

(1) ShareShare
ReportReport
Posted on by 92

Hi folks,

I have a Power Automate flow that returns a PDF as a Base64 string to my Power App. I want to use the Launch() function to open this Base64 string in a new browser tab to display or download the PDF. Unfortunately, I can’t get it to work so far, despite no errors being reported by Power Apps.

Here is my current OnSelect code for the button that triggers the Flow and attempts to open the PDF:

 
UpdateContext({locLoadingPDF: true});
UpdateContext(
    {
        locPDFBase64: 'WeighbridgeTickets-GeneratePDFofTicket'.Run(
            ThisItem.'Docket Number',
            ThisItem.'Client Name',
            ThisItem.'Material Direction',
            ThisItem.'Source Site or Destination',
            ThisItem.'EWC Code',
            ThisItem.Haulier,
            ThisItem.'Vehicle Registration',
            If(IsBlank(ThisItem.Comments), "", ThisItem.Comments),
            ThisItem.'1st Weight',
            ThisItem.'1st Weight Date/Time',
            ThisItem.'2nd Weight',
            ThisItem.'2nd Weight Date/Time',
            ThisItem.'2nd Weight Operator',
            ThisItem.'Net Weight'
        )
    }
);

UpdateContext({locLoadingPDF: false});

// Attempt to launch the PDF
Launch(locPDFBase64.pdfbase64);
When running this, nothing happens—no error messages, no browser pop-up, no new tab.
 
What I’ve Tried
  • Manual Pasting:
    If I set a Label’s Text property to locPDFBase64.pdfbase64 and copy/paste that entire data URI (data:application/pdf;base64,JVBERi0x...) into a new Chrome tab, it works and shows the PDF correctly.

  • Separate Launch Button:
    Tried using a separate button that just calls Launch(locPDFBase64.pdfbase64) after the Flow’s variable is populated—still doesn’t launch.

  • Monitor Logs:
    The Flow runs successfully and returns the PDF Base64. No errors appear in the Monitor. Below is a snippet of the response:

{
  "duration": 9010.69,
  "size": 207892,
  "status": 200,
  "headers": {
    "Cache-Control": "no-cache",
    "content-encoding": "gzip",
    "Content-Type": "application/json; charset=utf-8",
    "Date": "Sat, 04 Jan 2025 16:24:43 GMT",
    "expires": -1,
    "pragma": "no-cache",
    "strict-transport-security": "max-age=31536000; includeSubDomains",
    "timing-allow-origin": "*",
    "vary": "Accept-Encoding",
    "x-ms-apihub-cached-response": true,
    "x-ms-apihub-obo": false,
    "x-ms-client-tracking-id": "08584655990094421372403946145CU12",
    "x-ms-correlation-id": "b7c0bce1-f21c-4070-bb5f-eda5757b8810",
    "x-ms-dlp-gu": "-|-",
    "x-ms-dlp-re": "-|-",
    "x-ms-environment-id": "38e07919-055b-e52f-b0cc-6a471e46f8a4",
    "x-ms-error-type": "UnknownError",
    "x-ms-execution-location": "uksouth",
    "x-ms-ratelimit-burst-remaining-workflow-writes": 1729,
    "x-ms-ratelimit-remaining-workflow-download-contentsize": 123684844,
    "x-ms-ratelimit-remaining-workflow-upload-contentsize": 123892246,
    "x-ms-ratelimit-time-remaining-directapirequests": 11530895,
    "x-ms-request-id": "uksouth:b7c0bce1-f21c-4070-bb5f-eda5757b8810",
    "x-ms-tenant-id": "ccc263eb-4651-422e-a65b-2544ed58eada",
    "x-ms-tracking-id": "b7c0bce1-f21c-4070-bb5f-eda5757b8810",
    "x-ms-trigger-history-name": "08584655990094421372403946145CU12",
    "x-ms-workflow-id": "7faab504132a42b79b7027e15f61eecb",
    "x-ms-workflow-name": "23b8384e-6a8d-4e6b-96a2-1563922a46bb",
    "x-ms-workflow-run-id": "08584655990094421372403946145CU12",
    "x-ms-workflow-system-id": "/locations/uksouth/scaleunits/prod-20/workflows/7faab504132a42b79b7027e15f61eecb",
    "x-ms-workflow-version": "08584656510578608945"
  },
  "body": {
    "pdfbase64": "data:application/pdf;base64,JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFuZyhlbikg......"
},
"responseType": "json"
}
The PDF content is there, just not launching in the app.

Any Ideas?

  • The Base64 data is definitely valid (confirmed by manual paste into the browser).
  • I’m aware of potential browser or environment limitations on large data URIs, but my file is ~200 KB, which should be within typical limits.
  • Pop-up blockers don’t appear to be triggered.
  • I’ve tested in published mode (not just Preview) with the same result.

Has anyone encountered this issue or found a reliable workaround? I’ve seen suggestions like using Download() or temporarily storing the PDF in SharePoint, but I really prefer a direct “open in new tab” approach if possible.

Any advice would be greatly appreciated!

Categories:
I have the same question (0)
  • Verified answer
    Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    My guess is this doesn't work because your base64 string is too long for the Launch() function--but I'm not 100% sure.

    That said, I've done things like this (buttons/links to generated documents) a few different ways in the past.  If your flow that returns the PDF is actually generating the PDF, you could have it save the file in OneDrive, SharePoint, or anywhere, and return a sharing link to the Power App.  Then have your Launch() function open that sharing link.
     
    Another thing you could do is make a copy of your flow that Power Apps is calling, and instead of using a Power Apps trigger, use a "When an HTTP request is received" trigger and set the Method to "Get" and create a relative path structure to receive the variable inputs.
    E.g.
    Then have some action that generates file content and you return that with a Request Response action at the end.
    With the file content placed in the Body parameter.
     

    Then you'd save the flow and copy the url that is generated by the triggger and put it in your Launch() function in Power Apps. 

     You can use $-string or another method to replace each "variable" in the relative path of the url (e.g. {var1} and {var2} in my example) with your desired Power Apps variable values.  When the Launch() is triggered, it will open the GET endpoing in a new tab and if the flow runs successfully, it will return the file content to the open browser tab.


    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |

     
  • Omainesi Profile Picture
    92 on at
    Thanks for your reply @Mark Nanneman
     
    I have successfully been able to apply your solution, and it does work as intended. Unfortunately, it takes around 15 seconds to generate and then display the PDF in the browser, but the main delays are in the creating/saving word doc/converting/saving pdf steps - I think if I amend this process to be HTML > PDF I could speed it up significantly.
  • Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    @Omainesi 

    Yes, that's an unfortunately downside (the delay to create the PDF).  How were you handling that delay in the previous method?  A wait spinner+message in the Canvas App?  If you have the flow return a link to the canvas app you could display a wait message until that appears, and then perform the launch() to a new tab.

    I also like your solution to use HTML instead.  After years of working with on-demand custom PDFs for things like invoices and paystubs, I think most of the time HTML can serve the purpose better instead, as long as the option is there to download a pdf or print to pdf.

    If you're not aware you can have a flow with the Request Response return HTML to create a custom webpage that even has javascript and css.  In theory you could incorporate a sub flow to create the PDF and the first flow would just return a webpage with a progress bar and message that will redirect to the PDF when it finishes, or load it in an iframe.

    Matthew Devaney has an article on hosting an app/webpage with power automate:
     
     

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard