Adding different watermarks to each page

Sometimes you want to have different watermarks in the report output. To do this, you use the ReportForNav.Watermark.Image.Load(fromStream) function.

 

It is important that you call the function before the report runtime starts printing a new page (because the watermark will be printed before that). If you call the function on a section trigger on a header document, the watermark is only printed on the next page. Instead, you must call the function from the OnPreDataItem or a footer trigger on the previous page.

 

For example: one watermark on the first page and another one on the other pages:

 

List – OnAfterGetRecord()

IF (ReportForNav.PageNo = 1) THEN

    WatermarkFile.OPEN(‘C:\Nav Files\A.pdf’)

ELSE

    WatermarkFile.OPEN(‘C:\Nav Files\B.pdf’);

WatermarkFile.CREATEINSTREAM(WatermarkStream);

ReportForNav.Watermark.Image.Load(WatermarkStream);

WatermarkFile.CLOSE;

 

The function can also be used to append different PDF documents to a data item. The ForNAV AppendPdf function adds the same PDF to all data items but by printing out a blank page and using the ReportForNav.Watermark.Image.Load(fromStream) function for that page and loading a blank watermark after it has been printed, you can append a different PDF document for each record.