Microsoft Teams is the new Microsoft’s collaborative platform for collaborative working and I’m quite sure that quite soon everyone of you will use this platform as a Skype replacement (at least for business... (Continue reading)

If I have an on-premise installation of Dynamics 365 Business Central, can I move my database from a local SQL Server to Azure SQL by automating this task (no manual processing)?
I’ve received this... (Continue reading)

This seems to be one of the hottest “problems” when using Dynamics 365 Business Central SaaS: actually you cannot directly print a document on a printer, but you need to open the PDF file and then print... (Continue reading)

I saw different tickets and questions related to the title’s topic in the last weeks and I think there’s the need for a clarification. I wrote a post some months ago by explaining the Dynamics 365 Business... (Continue reading)

Microsoft has revealed to the general public the new Dynamics 365 Business Central features planned to be released in the April 2019 wave (from April through September 2019). Here a quick summary of what... (Continue reading)

Dynamics NAV: printing external documents and merging PDF files

These are old topics and someone has written on a solution for this in the past, but after some forum questions received today I think that a quick recap could be interesting.

Question 1: how to print external documents directly from NAV

There are scenarios where you need to print directly from NAV also external documents (like PDF, Word files or other things).

For this task, in my personal library I use a solution based on DotNet variables and the System.Diagnostics.Process class (that provides access to local and remote processes and enables you to start and stop local system processes). If I remember correctly, the idea from this comes from my friend Waldo (so credits to him ).

To solve this task, I have a C/AL function called PrintExternalDocument that receives a path of a file and calls a TryFunction PrintDocument for handling the printing. The C/AL code is as follows:

The key here is the verb Print passed to the ProcessStartInfo class (a .NET class that specifies a set of values that are used when you start a process). With that, the OS will use the process asociated to this document type to print the document.

Question 2: How to merge two PDF files into a single one

There are programs like BullZip (one of my favourite PDF printers to use with NAV) that have these functions available in the commercial version.

Here I post an old solution that uses a free and open source program called PDFMerge (available on GitHub here). Also for this task we need the usage of DotNet variables and the System.Diagnostics.Process class.

After installing PDFMerge, you can create a function called MergePDF that receives as input parameters the files to merge and the output PDF file.

Here is the C/AL code:

I’m sure that there are other solutions for these tasks, but this works

P.S. As you can see, these functions are not Dynamics 365 Business Central ready