Please wait
Talk to Expert

Preview PDF Attachments in Business Central (No Control Add-ins or APIs Required)

Preview PDF Attachments in Business Central (No Control Add-ins or APIs Required)

With the release of Dynamics 365 Business Central 2025 Wave 1 (BC26), Microsoft has introduced a powerful new feature: the ability to preview PDF attachments directly in the web client – no need for control add-ins or custom APIs.

This enhancement significantly improves user experience and productivity. Users can now easily view attachments, report outputs, or incoming documents without downloading them, staying focused on their tasks within Business Central.

Key Benefits

  • Instant PDF Preview – Preview PDF Attachments in Business Central. No download required.
  • Smooth Viewing Experience – Functions like a print preview with intuitive navigation.
  • Available Throughout Business Central – Works across various areas, from attachments to reports.
  • Download Option Still Available – PDFs can still be downloaded manually if needed.

Example Use Cases

Example 1 – Action View Button

You can now simply click “View” on a PDF attachment, and the document will open instantly in preview mode – no download required.

Example 2 – Attached Documents Section

In the Attached Documents area, clicking “View” will open the PDF in the same seamless preview window.

AL Methods to Support PDF Preview

To enable this feature in AL development, Microsoft has added two new methods:

  • ViewFromStream – for Business Central Online
  • View – for Business Central On-Premises

Syntax:

[Ok :=] File.ViewFromStream(Stream: InStream, FileName: String [, AllowDownloadAndPrint: Boolean]);

[Ok :=] File.View(FilePath: String [, AllowDownloadAndPrint: Boolean]);

Code ->

Code for Preview PDF

Output ->

Output of Preview PDF

Important Note:

This feature only supports files with a .pdf extension. If you try to preview a non-PDF file, it will throw an error and may freeze the web client. In such cases, the only solution is to refresh the browser tab.
Always validate that the file is indeed a PDF before calling the preview function. Do not rely solely on the return value of the method.

References

Microsoft Documentation – Preview PDF Attachments in Web Client

Let’s connect → Contact Madhda