Skip to main content

Notifications

Announcements

No record found.

Building a PDF Preview feature inside Dynamics 365 CE with JScript

    I recently encountered a question regarding the possibility of previewing a PDF file inside Dynamics 365 CRM or a Model Driven App without opening an additional tab or window. After conducting some research, I found that there is no out-of-the-box (OOTB) feature for previewing PDF files. However, I devised an approach to achieve this by leveraging client-side scripting, specifically using JScript.

 

One of the methods I explored is the Xrm.Navigation.openFile(file, openFileOptions) script. This script allows you to open a file in another tab or window. However, the goal is to have the file open inline within the Unified Client Interface (UCI) page. More details on this script can be found in the Microsoft Docs.

To implement this, I created a file field on the Accounts Entity named "Test File" and added it to the main form. The preview feature is intended for files uploaded to this column.

To accomplish the preview functionality, I decided to create an HTML web resource and a JS web resource. The HTML web page serves as a canvas for previewing a PDF file inside it, while the JS web resource is designed to open a modal window inline, containing the web page for previewing the file.

Follow the Original Post to read more


This was originally posted here.

Comments

*This post is locked for comments