With Dynamics 365 Business Central 2025 Wave 1 release (version 26) and the new AL Language extension version 15, it will be possible to preview a file directly in the web client (no need to use control add-ins anymore) without downloading it first.
Doing that is very easy. The new runtime 15 adds the following method to the File object:
File.ViewFromStream(Stream: InStream, FileName: String [, AllowDownloadAndPrint: Boolean]);
With the below code, you can read a file (for example a PDF) and preview it in the client:
This is the PDF rendered in preview mode in the client. Please note that you can also enable or disable the possibility to download and print it:
If the loaded file is not supported for previewing, an error message will be displayed:
Starting from Dynamics 365 Business Central version, this feature is used in various areas like document attachments and incoming documents to automatically preview an uploaded document:
Also a new method is available for Dynamics 365 Business Central on-premises:
File.View(FilePath: String [, AllowDownloadAndPrint: Boolean]);
but who cares about non SaaS-compliant code, isn’t it?
Original Post https://demiliani.com/2025/03/10/dynamics-365-business-central-previewing-a-file-from-al/