Current Append/Prepend PDF

Sometimes, adding the same PDFs to each document in a report is not sufficient and you must apply different PDFs, depending on the data (for example, Language).

To be able to add the set of PDFs needed in a report, the Pdf.Store(key,image) function needs to be added to OnPreReport. Pdf.AppendFromStore(key) + Pdf.PrependFromStore(key), needs to be added to a specific record in the OnAfterGetRecord JavaScript trigger.

For example, to add specific terms to each document in a report when the language is Danish, and different terms in another language, you can use the ForNAV File Storage table to store the PDFs:

 

In the JavaScript record editor, you can then define two records that point to the records containing the PDFs:

 

To store the PDFs in the report dataset, you call the Pdf.Store function with a key so you can identify them in the OnPreReport Javascript trigger:

 

To append a PDF based on the language in the document header, you call the Pdf.AppendFromStore function in the OnAfterGetRecord JavaScript trigger with the keys you defined in the OnPreReport JavaScript trigger:

 

Keywords: Append/Prepend PDF pr. record;
Append/Prepend PDF per record