Here's a ReportListener that generates watermark pictures in reports.
Very simple to setup, just set some properties, like the logo image, width and height ratio, transparency ratio.
_SCREEN.AddProperty("System", NEWOBJECT("xfcSystem", LOCFILE("system.vcx","vcx")))
LOCAL loListener as ReportListener
loListener = CREATEOBJECT("WatermarkListener")
loListener.LISTENERTYPE = 1
loListener.WaterMarkImage = ADDBS(HOME()) + "Graphics\Gifs\morphfox.gif"
loListener.WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
loListener.WaterMarkTransparency = 0.25 && 0 = transparent ; 1 = Opaque
loListener.WaterMarkWidthRatio = 0.75 && 0 - 1
loListener.WaterMarkHeightRatio = 0.75 && 0 - 1
* Run the report using the new report engine (object-assisted output)
REPORT FORM (ADDBS(HOME()) + "samples/solution/europa/employeesmd.frx") OBJECT loListener
RETURN
Below are some samples generated by the WaterMarkListener class. (source code at the end of this post)
1 -
WaterMarkType = 1 && 1 = Colored ; 2 = GreyScale
WaterMarkTransparency = 1 && 0 = transparent ; 1 = Opaque
WaterMarkWidthRatio = 0.90 && 0 - 1
WaterMarkHeightRatio = 0.90 && 0 - 1

2 -
WaterMarkType = 1 && 1 = Colored ; 2 = GreyScale
WaterMarkTransparency = 0.25 && 0 = transparent ; 1 = Opaque
WaterMarkWidthRatio = 0.50 && 0 - 1
WaterMarkHeightRatio = 0.50 && 0 - 1

3 -
WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
WaterMarkTransparency = 0.10 && 0 = transparent ; 1 = Opaque
WaterMarkWidthRatio = 1 && 0 - 1
WaterMarkHeightRatio = 1 && 0 - 1
4 -
WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
WaterMarkTransparency = 25 && 0 = transparent ; 1 = Opaque
WaterMarkWidthRatio = 0.75 && 0 - 1
WaterMarkHeightRatio = 0.75 && 0 - 1

_SCREEN.AddProperty("System", NEWOBJECT("xfcSystem", LOCFILE("system.vcx","vcx")))
LOCAL loListener as ReportListener
loListener = CREATEOBJECT("WatermarkListener")
loListener.LISTENERTYPE = 1
loListener.WaterMarkImage = ADDBS(HOME()) + "Graphics\Gifs\morphfox.gif"
loListener.WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
loListener.WaterMarkTransparency = 0.25 && 0 = transparent ; 1 = Opaque
loListener.WaterMarkWidthRatio = 0.75 && 0 - 1
loListener.WaterMarkHeightRatio = 0.75 && 0 - 1
* Run the report using the new report engine (object-assisted output)
REPORT FORM HOME() + "samples/solution/europa/employeesmd.frx") OBJECT loListener
RETURN
DEFINE CLASS WatermarkListener AS _ReportListener OF HOME() + "FFC\" + "_ReportListener.VCX"
NewPage = .T.
oGDIGraphics = NULL
WaterMarkImage = ""
WaterMarkType = 1 && 1 = Colored ; 2 = GreyScale
WaterMarkTransparency = 0.50 && 0 = transparent ; 1 = Opaque
WaterMarkWidthRatio = 0.50
WaterMarkHeightRatio = 0.50
FUNCTION BEFOREREPORT
DODEFAULT()
This.oGDIGraphics = _SCREEN.SYSTEM.Drawing.Graphics.New()
ENDFUNC
FUNCTION BEFOREBAND(nBandObjCode, nFRXRecNo)
#DEFINE FRX_OBJCOD_PAGEHEADER 1
IF nBandObjCode==FRX_OBJCOD_PAGEHEADER
This.NewPage = .T.
IF NOT This.IsSuccessor
This.SharedGDIPlusGraphics = This.GDIPLUSGRAPHICS
ENDIF
This.oGDIGraphics.Handle = This.SharedGDIPlusGraphics
ENDIF
DODEFAULT(nBandObjCode, nFRXRecNo)
ENDFUNC
PROCEDURE RENDER(nFRXRecNo,;
nLeft,nTop,nWidth,nHeight,;
nObjectContinuationType, ;
cContentsToBeRendered, GDIPlusImage)
WITH _SCREEN.SYSTEM.Drawing
IF This.NewPage
LOCAL lnX, lnY, lnWidth, lnHeight
lnX = (1 - This.WaterMarkWidthRatio) / 2
lnY = (1 - This.WaterMarkHeightRatio) / 2
lnWidth = This.WaterMarkWidthRatio
lnHeight = This.WaterMarkHeightRatio
* Create a Rectangle of the size of 60% of the report page
LOCAL loRect AS xfcRectangle
loRect = .Rectangle.New(lnX * This.sharedPageWidth, ;
lnY * This.sharedPageHeight, ;
This.sharedPageWidth * lnWidth, ;
This.sharedPageHeight * lnHeight)
* Load the Image File to GDI+
LOCAL loBmp as xfcBitmap
loBmp = .Bitmap.New(This.WaterMarkImage)
LOCAL loClrMatrix AS xfcColorMatrix
IF This.WaterMarkType = 2 && 1 = Colored ; 2 = GreyScale
loClrMatrix = .Imaging.ColorMatrix.New( ;
.33, .33, .33, 0 , 0, ;
.33, .33, .33, 0 , 0, ;
.33, .33, .33, 0 , 0, ;
0, 0, 0, This.WaterMarkTransparency, 0, ;
0, 0, 0, 0, 0)
ELSE
loClrMatrix = .Imaging.ColorMatrix.New()
loClrMatrix.Matrix33 = This.WaterMarkTransparency
ENDIF
LOCAL loAttr AS xfcImageAttributes
loAttr = .Imaging.ImageAttributes.New()
loAttr.SetColorMatrix(loClrMatrix)
This.oGdiGraphics.DrawImage(loBmp, loRect, loBmp.GetBounds(), 2, loAttr)
This.NewPage = .F.
ENDIF
ENDWITH
DODEFAULT(nFRXRecNo,;
nLeft,nTop,nWidth,nHeight,;
nObjectContinuationType, ;
cContentsToBeRendered, GDIPlusImage)
ENDPROC
ENDDEFINE