Automated Report Printing to PDF

Hi everyone,

With the use of third party software its very easy to print to PDF any given report from Navision. So far so good… But I was wondering if its possible in any way to generate my report on a predefined Watermark or Layer. I need this since the named report is currently being printed manually on pre-printed stationery so it was specifically designed to fit and fill specific parts of the paper. Lately we launced our system online and the named report is to be automatically generated to PDF and mailed to the user. My idea was to use the same report and create a layer/watermark of our pre-printed stationery on the same file.

I was wandering if anyone ever had to deal with such a problem. If so I would greatly appreciate any help given.

Thanks in advance,


take a look at pdfcreator. It has watermark functionality.

I’ll have a look at that, hope you can predefine watermarks / layers through the automated process.

Thanks a million Rashed. [Y]

Hi again,

Wanted to thank you because the suggested solution worked perfect and using some scripts I was able to create exactly what we were looking for. However I have one more question.

Would it be possible to send the created file automatically without the use of a client. Using the Mail codeunit I managed to create the mail with the attachment and everything but it still requires human intervention to be sent. I really need to send it automatically attaching the above created PDF file as an attachment .



If you are using NAV5.0 you can use codeunit 400 SMTP Mail. It requires no user actions to send emails w. attachments.

MailSent := MAPIMail.NewMessage(ToName,CCName,Subject,Body,AttachFileName,OpenDialog)

As I explained in the previous post, I need this to send automated mails with no additional clicks or anything. Using the Mail.NewMessage still pops up a small outlook window prompting me to accept that something is trying to send withought my authoristation.

To add to it, we dont use Outlook Exchange but Lotus Notes.

Thanks for the help.

Was looking at some other posts and found

function NewCDOMessage(ToName : Text[80];Subject : Text[260];Body : Text[1024];AttachFileName : Text[260])

// recSetup – a table with SMTP fields
// objEmailConf – ‘Microsoft CDO For Exchange 2000 Library’.Configuration
// objEmail – ‘Microsoft CDO For Exchange 2000 Library’.Message
// flds – ‘Microsoft ActiveX Data Objects 2.5 Library’.Fields
// fld – ‘Microsoft ActiveX Data Objects 2.5 Library’.Field

recSetup.TESTFIELD(“SMTP Server Name”);
recSetup.TESTFIELD(“SMTP Server Port”);
recSetup.TESTFIELD(“E-Mail From”);
flds := objEmailConf.Fields;

fld := flds.Item(‘’);
fld.Value(recSetup.“SMTP Server Name”);

fld := flds.Item(‘’);
fld.Value(recSetup.“SMTP Server Port”);

fld := flds.Item(‘’);


IF ISCLEAR(objEmail) THEN CREATE(objEmail);
objEmail.Configuration := objEmailConf;
objEmail.From := recSetup.“E-Mail From”;
objEmail.“To” := ToName;
objEmail.Subject := Subject;

IF Body <> ‘’ THEN
objEmail.TextBody := Body;
IF AttachFileName <> ‘’ THEN
IF Body=’’ THEN
objEmail.TextBody :=’ ';


My only concern is how to input exactly the SMTP server name, port etc. Should I use the IP? Use the masking from the host file etc.

Would appreciate any help, thanks


Got all settings right and everything is working perfect when I send locally. If I try to send anything outside I get an error

"The call to member failed. Unknown Class returned the following message: The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for

Managed to fix the problem. It seems we had to setup relaying options on our mail server (domino). Once we setup the IP of the machine generating the SMTP request everything worked fine.

Should have been:


codeunit 400, SMTP Mail. Does not require any user interaction.