Adding different watermarks to each page

Sometimes you might want to have different watermarks in the report output. To do this, you can use one of the following two options:

  1. Use the ReportForNav.LoadWatermark (AL) or the ReportForNav.AddWatermark (JavaScript)  functions in OnPreReport to set up the watermark per page:
    • In AL: ReportForNav.LoadWatermark(<pageno>,<outstream>)
    • In JavaScript: CurrReport.AddWatermark(<pageno>,<blobfield>)
    • Where pageno is interpreted as 0 = all, or 1… = page number

  3. Use the ReportForNav.Watermark.Image.Load(fromStream) (AL) or ReportForNav.Watermark.Image.Image = Rec.Blob (JavaScript) to set the watermark before page breaks in the OnAftergetRecord or Section trigger.

It is important that you call the function before the report runtime starts printing a new page (because the watermark is 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')


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




You can also use the function to append different PDF documents to a data item. The ForNAV AppendPdf function adds the same PDF to all data items but if you print a blank page and use the ReportForNav.Watermark.Image.Load(fromStream) function for that page and load a blank watermark after it is printed, you can append a different PDF document for each record.