Prepending and appending PDF files to a ForNAV report

To add PDF’s before and after the output of a DataItem (for example: an invoice) you can use the Append and Prepend JavaScript functions using a BLOB field with the PDF as parameter.

The PDF’s can be stored in any table with a BLOB field. However, the easiest way to do this is to use the ForNAV File Storage page to import the PDF’s and create JavaScript records for each of them in the layout:

After that you can add code in the OnPreReport JavaScript trigger. In this example the ‘A’ PDF is prepended and the ‘B’+’C’ PDF’s are appended to each Sales Header:


    CurrReport.DataItems.Header.Pdf.Prepend(A.Data);
    CurrReport.DataItems.Header.Pdf.Append(B.Data);
    CurrReport.DataItems.Header.Pdf.Append(C.Data);

And the result is this: