I am trying to create a watermark using .NET. The KB suggest to use the
DrawPage event to do this. My code looks like:
DEF VAR oGraphics AS System.Drawing.Graphics NO-UNDO. DEF VAR oFont AS System.Drawing.Font NO-UNDO. DEF VAR oBrush AS System.Drawing.Brush NO-UNDO. DEF VAR oColor AS System.Drawing.Color NO-UNDO. DEF VAR oPointF AS System.Drawing.PointF NO-UNDO. DEF VAR oRectangle AS System.Drawing.Rectangle NO-UNDO. ASSIGN oGraphics = oClass:Graphics. oFont = NEW System.Drawing.Font("Arial", 100). oBrush = NEW System.Drawing.SolidBrush(System.Drawing.Color:Black). oGraphics:DrawString("Demoversion", oFont, oBrush, 0, 0).
However, when I run this code, it does not show any watermark on the page. I also tried to use the DrawProject event with same outcome.
The help file states “Notes for .NET Standard/Core: Drawing events such as DrawPage, DrawDesignerObject, etc. are triggered, but cannot be used for drawing because the reference to the .NET graphics object is not available or is null”.
So I am wondering: is my code wrong or is it simply not possible to use this method?
As we have the Professional Edition, the alternative would be to use the DOM API. What would be the best event to use in that scenario?