Skip to main content
Dynamics 365 general forum
Suggested answer

How to open PDF in Dynamics 365 phone app and desktop app

editSubscribe (0) ShareShare
Posted on by 105

I have a custom button in Dynamics 365 that creates a PDF file stream. I want to open this file from the Dynamics 365 app for phone and desktop app. I tried the following javascript which works in the browser version of Dynamics 365 on a PC but does not work in the "Microsoft Dynamics 365 (Preview)" on PC or on the Dynamics 365 app on both android and iOS.

var fileURL = URL.createObjectURL(file);;


const win ="", "_blank");
let html2 = '';

html2 += '<html>';
html2 += '<body style="margin:0!important">';
html2 += '<embed width="100%" height="100%" src="' + data + '" type="application/pdf" />';
html2 += '</body>';
html2 += '</html>';

setTimeout(() => {
}, 0);

With browser on a PC, either one of these code will launch a new tab with the PDF file loaded but on android/ios app there is nothing happen and with the "Dynamics 365 (Preview)" app on Windows I get the message below with no options to choose a browser or a pdf viewer.


  • Kirk T Profile Picture
    Kirk T 105 on at
    RE: How to open PDF in Dynamics 365 phone app and desktop app

    I did not try the suggested code but what works for me is to use the built-in client-api for Dynamics 365 openFile

  • Suggested answer
    Community Member Profile Picture
    Community Member UG Leader on at
    RE: How to open PDF in Dynamics 365 phone app and desktop app

    Hi Kirk T,

    You could try the code in the following post:

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,066 Super User

Martin Dráb Profile Picture

Martin Dráb 222,585 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans