Automatic watermark font size

Stimulsoft Reports.NET discussion
Post Reply
Stéphane
Posts: 74
Joined: Wed Dec 06, 2006 3:45 am
Location: Paris (France)

Automatic watermark font size

Post by Stéphane »

Hello,

I try to adjust automatically the font size of the watermark text in order to fill the whole page. How can I accomplish this ? Any ideas ?


Cordially,
Kakone.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Automatic watermark font size

Post by Vital »

Please place following code in BeforePrintEvent of page:

Code: Select all

StiText text = new StiText();
text.ClientRectangle = Page1.ClientRectangle;
text.Text.Value = Page1.Watermark.Text;
text.Angle = Page1.Watermark.Angle;
text.Page = Page1;
text.Font = new Font(Page1.Watermark.Font.FontFamily, 1020);
Page1.Watermark.Font = text.GetActualFont(Page1.Watermark.Text);
Thank you.
Stéphane
Posts: 74
Joined: Wed Dec 06, 2006 3:45 am
Location: Paris (France)

Automatic watermark font size

Post by Stéphane »

It's perfect !

Thanks a lot.
Post Reply