Sunday, 26 October 2008

NAV - Print & E-Mail PDF

This has been blogged and discussed on forums many times before but I thought I would write one about Amyuni. I have been using it for a number of years and IMHO is a very good product. This also works on vista and x64.

Here is how to use it – I won't go into detail with all the variables etc:
//PDFConverter – Automation - 'Common Driver Interface Control'.CDIntfEx
IF ISCLEAR(PDFConverter) THEN
  CREATE(PDFConverter);

// PrinterNameText on default install is 'Amyuni PDF Converter'
PDFConverter.DriverInit(PrinterNameText);
PDFConverter.Lock(PrinterNameText);

//You must enable the printer with the correct licensee and activation code.
//If this is different to the installation – you will get an error.
PDFConverter.EnablePrinter(LicenseeText,ActivationCodeText);
PDFConverter.FileNameOptions(3);
PDFConverter.DefaultDirectory(TEMPORARYPATH);
PDFConverter.SetDefaultPrinter;
PDFConverter.DefaultFileName(TempFileName);

REPORT.RUNMODAL(REPORT::"Sales – Invoice",FALSE,TRUE,SalesInvHeader);

PDFConverter.FileNameOptions(0);
PDFConverter.RestoreDefaultPrinter;

//Codeunit 397 - Mail
IF Mail.NewMessage(SendTo,'',EmailSubject,EmailBody,TempFileName,TRUE) THEN;
ERASE(TempFileName);
Most common issue people have with this is. The activation code doesn't match what has been installed or a different version is used.

List of possible error codes are available here:

http://www.amyuni.com/forum/viewtopic.php?p=6671&sid=e3fb6c01251153f5b6e48e452169b1a4

Other option to try:

PDF Creator http://www.mibuso.com/forum/viewtopic.php?f=5&t=18331&st=0&sk=t&sd=a&hilit=pdf+converter+navision+ara3n&start=45

Bullzip http://mibuso.com/blogs/ara3n/2008/08/01/save-nav-reports-to-pdf/

Note: This is one of many options. Amyuni is not free but I believe well worth it.

No comments: