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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

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

(0) ShareShare
ReportReport
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);
window.open(fileURL);

OR

const win = window.open("", "_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(() => {
 win.document.write(html2);
}, 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.

pastedimage1640194641572v1.png

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Kirk T,

    You could try the code in the following post:

    stackoverflow.com/.../open-or-download-pdf-file-for-printing-from-iphone-using-js

  • Kirk T Profile Picture
    105 on at

    I did not try the suggested code but what works for me is to use the built-in client-api for Dynamics 365 openFile docs.microsoft.com/.../openfile

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 61

#2
Martin Dráb Profile Picture

Martin Dráb 39 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 32 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans