Watermark an image with reportviewer (full page report)

reportviewervisual studio 2012watermark

I know i can watermark an image with reportviewer 2012 in the body part of the page.
My report has header and footer, i need watermark an image in angle for the full page, from the bottom-left to the top-right and that will include the header, body and footer.

Any Idea? Thank you.

Best Answer

SSRS doesn't natively have a Watermark function, but you have a couple workarounds.

Fix 1 - Background Image

  1. Create an image with the watermark you want (save as .bmp)
  2. Add the image to the report
  3. Set the Report Body Background property to use the image.
    Body Properties

For Step 1, I like the following method:

  1. Create a Word Document
  2. Go to Page Layout > Watermark > Custom > and add whatever watermark you want
    Printed Watermark
  3. Save the Word Document as PDF.
  4. Open the PDF and Select "Copy File to Clipboard"
    Copy File to Clipboard
  5. This will create the correct sized image at 612x792. Paste into MSPaint and save as a bitmap. Here's a sample generated image that just says "TEST" that you can use.

Conditionally Applying:

Most times you have a watermark, you want to eventually remove it. Let's say you have a test and production report and you want to toggle the watermark. You can do it like this:

  1. Add a Boolean Parameter, here called IsTest. It should look like this:
    Report Data
  2. On the Body Properties menu, set the background image to use the following formula:

    =iif(Parameters!IsTest.Value,"TestWatermark","")
    

    Background Image Expression

  3. When you're calling the report, make sure to pass in the parameter like this:

    report.SetParameters(New ReportParameter("IsTest", appSettings.IsTestEnvironment))
    

Fix 2 - Text Field

Alternatively, you can do this with a text field for a little less heavy handed of an approach, but it cannot be rotated at a 45o angle.

  1. Add a text field to the report. Make it large and grey.
  2. Right click on the text field and click Send to Back so it appears behind all the other elements.
  3. Make sure that any other fields with a white background have a transparent background, otherwise you'll get a blotchy display.

Further Reading

Related Topic