Create watermark dynamic

Stimulsoft Reports.NET discussion
Post Reply
Mandy
Posts: 3
Joined: Fri Aug 14, 2015 8:27 am

Create watermark dynamic

Post by Mandy »

Hello,

I'm looking for a possibility to add a watermark.
I found a note at https://www.stimulsoft.com/en/documenta ... rmarks.htm but there are still the first question:
Where can I get any further infos how to do this?

I spent a lot of time to play around, but its not working.
This brings up an error
error BC30456: "Item365" ist kein Member von "Reports.rptVKRechnung"

Code: Select all

   Dim img As New StiImage()
        img.Name = "Wasserzeichen"
        img.PrintOn = bild.printOn.Value
        img.Image = System.Drawing.Image.FromFile(bild.file.FullName)
        img.Stretch = True
        img.Report = report
        img.Left = 0
        img.Width = report.Pages(0).Width
        img.Top = 0
        img.Height = report.Pages(0).Height
        img.Enabled = True
        img.CanShrink = True
        img.CanGrow = True
        img.Linked = False
        For Each page As StiPage In report.Pages
            page.Components.Add(img)
        Next
trying with watermark itself also did not work:
(the image was created like above, Text was correctly shown but I got now picture)

Code: Select all

            page.Watermark = New StiWatermark()
            page.Watermark.Enabled = True
            page.Watermark.Image = img.Image

            page.Watermark.ImageAlignment = Drawing.ContentAlignment.TopLeft
            page.Watermark.ImageStretch = True
            page.Watermark.ImageTiling = True
            page.Watermark.ShowImageBehind = False
            page.Watermark.Text = "TEST"
Who can help please?

Thanks,
Mandy
Mandy
Posts: 3
Joined: Fri Aug 14, 2015 8:27 am

Re: Create watermark dynamic

Post by Mandy »

Hello again,

its working now, there was a bug on another line :oops:

Here the complete code for adding a picture on the whole page, mybe its helpful for others:

Code: Select all

      ' create the image
        Dim img As New StiImage()
        img.Name = "Wasserzeichen"
        img.PrintOn = bild.printOn.Value
        img.Image = System.Drawing.Image.FromFile(bild.file.FullName)
        img.Stretch = True
        img.Enabled = True
        img.Linked = False

        ' set the size from page, and left and top margins as negatives
        For Each page As StiPage In report.Pages
            img.Left = -page.Margins.Left
            img.Width = page.DisplayRectangle.Width
            img.Top = -page.Margins.Top
            img.Height = page.DisplayRectangle.Height
            page.Components.Add(img)
        Next
But there is still the question for a 'more in deep' manual for programmers...

Thanks,
Mandy
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Create watermark dynamic

Post by Alex K. »

Hello,

At the current moment, we are working on the new documentation for developers with samples and descriptions.
We will publish it in the near future.

Thank you.
Post Reply