Watermarks in RDL reports

Posted by: Jens.Rickhoff on 24 May 2018, 5:19 am EST

    • Post Options:
    • Link

    Posted 24 May 2018, 5:19 am EST

    We have an RDL report template which includes a static cover page (as subreport), a Table of Contents control and a container which serves as a placeholder for multiple subreports that are added dynamically from code to the report. It also has a header and footer. Everything works fine so far.

    Now we are trying to add a “watermark” to the report pages with the following requirements:

    • it is text-only
    • it must be printed vertically on the right margin
    • it must exist in the previewer as well as on exports and prints
    • it must be possible to show a different (or no) watermark on different pages

    Avenues we investigated for the solution:

    1. A Textbox with a 90° angle on the right margin. Only works properly on (fixed) PageReports which we cannot use due to our dynamic subreport compilation, so our report is not really page-oriented.
    2. A PDF watermark on export. Only allows watermarks on export to PDF and positions the watermark always in the middle of the page.
    3. A background image (text converted to an image). Makes positioning on the right page margin difficult (white padding to the top and left). However it does not seem to allow for different background images on different pages.
    4. Do #3 and split up the report in multiple RdlReports depending on the number of different watermarks we need. This does not allow for a correct Table of contents though, and combining the multiple report documents into a single one does not seem possible.

    Solution #3 looks like the most promising. We tried specifying an expression for the background image to make it dependent on the page number like ```

    =IIF(Globals!PageNumber > 10, “someWatermark.png”, “someOtherWatermark.png”)

    
    What can we do to get a watermark that fulfills above requirements?
  • Posted 25 May 2018, 4:44 am EST

    Hello Jens,

    Unfortunately, this is not possible through RDL report due to its continuous layout.

    There is a workaround for the above, but we need the exact page number of the report that can be rendered. Is it possible for you to have exact page number before the report load?

    Thanks,

    Mohit

  • Posted 25 May 2018, 5:33 am EST

    No, we do not know the exact page number(s) in advance.

    However, we do have a custom data source and a custom resource locator which could keep track of where the report currently is, we’re quite flexible in that regard. So instead of relying on page numbers, it would actually make more sense to query the watermark from data (=Field!Watermark.Value). However, we’d need some context information to decide which watermark to show, and (as I said) the fact that the expression needs to be evaluated on each physical page.

    Perhaps it is possible alternatively to set the watermark on the resulting PageDocument after pageReport.Run() has been executed? Or registering some event handler that gets executed on each page during rendering that is able to set the watermark in some way?

  • Posted 28 May 2018, 9:26 am EST

    Hello,

    We are working on your issue and will inform you once we found any suitable way to achieve your requirement.

    Thanks,

    Mohit

  • Posted 29 May 2018, 1:16 am EST

    Hello Jens,

    As a workaround, you can use the original RDL report into Page report to display the watermark according to the page number. Please refer the attached report to implementing the same.

    Thanks,

    Mohit

    Watermark.zip

  • Posted 29 May 2018, 5:50 am EST

    Hi Mohit,

    I think that would work for us, thank you very much for following up with this workaround!

    Jens

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels