Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Watermark can be text or image. The basic settings are: orientation, horizontal and vertical alignment and auto size. So the text or image can be placed in the lower right corner or centered on the page. The preview view provides a preliminary result for the current page in the preview. For simpler settings, you can use the appropriate methods described below.

Followed options is portrait, landscape, diagonal and rotate for orientaion. 

Horizontal and vertical alignment determines the basic position of the watermark in portrait and landscape orientation. Horizontal alignment can be: left, center, right or justify for text only. Vertical alignment can be: top, middle and bottom.

If the orientation is diagonal, then the watermark is placed in a line from the lower left corner to the upper right corner.

If setting the rotation option, you can also set the angle.

When the autosize option is checked, the watermark will adjust to the page size and orientation.


Info

Print and export has separate watermark settings.

The watermark object

Objects:

NameDescriptionXFRX
versionoText
Watermark object for text.22.0oImageWatermark object for image.22.0

Properties:

NameType DescriptionXFRX
versioniModenumberWatermark mode.  The allowed values are:

   0 ... nothing (default value)
   1 ... text
   2 ... image

22.0lShowPreviewboolean Show preview in "Watermark options" dialog.22.0

Table of Contents

Watermark text

Image Removed

Methods:

NameDescriptionXFRX
versionSetAlignment

This method set horizontal and vertical aligment.

Parameters:

m.luHAlign  – horizontal alignment;   values: "left" (0), "center" (1), "right" (2), "justify" (3)

m.luVAlign – vertical algnment;   values: "top" (0), "middle" (1), "bottom" (2)

22.0SetOrientation

This method set text orientation.

Parameters:

m.luOrientaion  – orientation;   values: "portrait" (0), "landscape" (1), "diagonal" (2), "rotate" (3)

m.lnAngle – angle in degree for rotate orientaion

22.0SetColor

This method set color.

Parameters:

m.liFCR – foreground color red

m.liFCG – foreground color green

m.liFCB – foreground color blue

m.liBCR – background color red

m.liBCG – background color green

m.liBCB – background color blue

Parameters:

m.liFGC – foreground color

m.liBGC – background color

22.0SetFont

This method set font.

Parameters:

m.lcFontName – font name

m.lnFontSize – font size, minimal value is 4, maximal vaue is 140

m.lcFontSTYLE – font style, "N" - normal, "I" - italic ,"B" - bold, "S" - strike through, "U" - underline

m.liFontEmbedded – embedding flag, 0 - none, 1 - subset, 2 - all, 3 - unicode

22.0SetText

This method set text.

Parameters:

m.lcText – water mark text.

m.liCodePage – codepage 

m.llAutoSize – auto size flag. If value is true, then font size will be calculated by page size.

22.0

Properties:

NameType DescriptionXFRX
versioniHAlignnumberHorizontal alignment. Values are: 0 - left,  1 - center, 2 - right,  3 - justify22.0iVAlignnumberVertical alignment. Values are:  0 - top, 1 - middle, 2 - bottom22.0iOrientationnumberOrientation. Values are: 0 - portrait, 1 - landscape,  2 - diagonal,  3 - rotate22.0nAnglenumberAngle for orientaion "rotate".22.0iFCRnumber

Foreground color red.

22.0iFCGnumberForeground color green.22.0iFCBnumberForeground color blue.22.0iBCRnumberBackground color red.22.0iBCGnumberBackground color green.22.0iBCBnumberBackground color blue.22.0cFontNamestringFont name.22.0nFontSizenumberFont size.22.0lFontBoldbooleanFont bold flag.22.0lFontItalicbooleanFont italic flag.22.0lFontUnderlinebooleanFont underline flag.22.0lFontStrikeThroughbooleanFont strike through flag.22.0iFontEmbeddednumberFont embedded flag. Values are: 0 - none, 1 - subset, 2 - all, 3 - unicode22.0cTextstringWater mark text.22.0iCodePagenumberCode page.22.0lAutoSizebooleanAuto size flag. If value is true, then font size will be calculated by page size.22.0

Watermark image

Specific mask settings are intended for either PDF or printing or export to images - restrictions are described below. A mask can be a color (a range of two colors), a clipping mask (a black and white image to which the source image is cropped), or an alpha mask (a grayscale image defining translucency at a specific point in the source image).

Image Removed

Methods:

NameDescriptionXFRX
versionSetAlignment

This method set horizontal and vertical aligment.

Parameters:

m.luHAlign  – horizontal alignment;   values: "left" (0), "center" (1), "right" (2)

m.luVAlign – vertical algnment;   values: "top" (0), "middle" (1), "bottom" (2)

22.0SetOrientation

This method set text orientation.

Parameters:

m.luOrientaion  – orientation;   values: "portrait" (0), "landscape" (1), "diagonal" (2), "rotate" (3)

m.lnAngle – angle in degree for rotate orientaion

22.0SetImage

This method set image.

Parameters:

m.lcText – water mark text.

m.llAutoSize – auto size flag. If value is true, then font size will be calculated by page size.

m.lnAdjustType –  adjust mode; 0 - clip picture, - stretch picture, retain shape, - stretch picture, fill frame

m.lcMaskColor – Mask color for creating transparent image (for PDF, print and preview).

m.lcSMaskImage – Soft mask image - apply alpha mask to watermark image.

m.lcMaskImage – Mask image - create transparent image or cut watermark image.

m.llNEG – Flag of image in negative colors (for PDF, print and preview).

m.liPagePicture – Page picture - for TIFF image.

22.0

Properties:

NameType DescriptionXFRX
versioniHAlignnumberHorizontal alignment. Values are: 0 - left,  1 - center, 2 - right22.0iVAlignnumberVertical alignment. Values are:  0 - top, 1 - middle, 2 - bottom22.0iOrientationnumberOrientation. Values are: 0 - portrait, 1 - landscape,  2 - diagonal,  3 - rotate22.0nAnglenumberAngle for orientaion "rotate".22.0cImagestringWater mark image.22.0lAutoSizebooleanAuto size flag. If value is true, then font size will be calculated by page size.22.0nAdjustTypenumber

Adjust mode:

0  … clip picture
1  … stretch picture, retain shape
2  … stretch picture, fill frame

22.0cMaskColorstringMask color for creating transparent image (for PDF, print and preview).22.0cSMaskImagestringSoft mask image - apply alpha mask to watermark image.22.0cMaskImagestringMask image - create transparent image or cut watermark image.22.0lNEGbooleanFlag of image in negative colors (for PDF, print and preview).22.0iPagePicturenumberPage picture - for TIFF image.22.0

Watermark text

Specific text watermark settings.

Image Added

Watermark text examples

Code Block
USE invoices 
ORDER customer 
LOCAL m.loSession, m.lnRetval, m.loXFF, m.loPreview, m.loScripts 
m.loSession=EVALUATE([xfrx("XFRX#LISTENER")]) 
m.lnRetVal = m.loSession.SetParams("",,,,,,"XFF") && no name = just in memory 
IF m.lnRetVal = 0 
   REPORT FORM invoices OBJECT m.loSession 
   m.loXFF = m.loSession.oxfDocument 
   * 
   * initialize the previewer 
   * SET CLASSLIB TO xfrxlib ADDITIVE 
   m.loPreview = CREATEOBJECT("frmMPPreviewer") 
   m.loPreview.windowType = 0 
   m.loPreview.iBook = 0 

   WITH loPreview.oExportOptions
   .oWM.lShowPreview=.T.
   .oWM.iMode=1
   .oWM.oText.SetText("W A T E R  M A R K", ,.T.)
   .oWM.oText.SetFont("Tahoma", 30, "B")
   .oWM.oText.SetColor(125, 125, 125)
   .oWM.SetOrientation("diagonal")
   ENDWITH

   m.loPreview.PreviewXFF(loXFF) 
   m.loPreview.show(1) 

ENDIF 


Watermark image

Specific mask settings are intended for either PDF or printing or export to images - restrictions are described below. A mask can be a color (a range of two colors), a clipping mask (a black and white image to which the source image is cropped), or an alpha mask (a grayscale image defining translucency at a specific point in the source image).

Image Added

Watermark image examples

Code Block
USE invoices 
ORDER customer 
LOCAL m.loSession, m.lnRetval, m.loXFF, m.loPreview, m.loScripts 
m.loSession=EVALUATE([xfrx("XFRX#LISTENER")]) 
m.lnRetVal = m.loSession.SetParams("",,,,,,"XFF") && no name = just in memory 
IF m.lnRetVal = 0 
   REPORT FORM invoices OBJECT m.loSession 
   m.loXFF = m.loSession.oxfDocument 
   * 
   * initialize the previewer 
   * SET CLASSLIB TO xfrxlib ADDITIVE 
   m.loPreview = CREATEOBJECT("frmMPPreviewer") 
   m.loPreview.windowType = 0 
   m.loPreview.iBook = 0 

   WITH loPreview.oExportOptions
   .oWM.lShowPreview=.T.
   .oWM.iMode=2
   .oWM.oImage.SetImage(FULLPATH("xfrx.jpg"), .T.)
   .oWM.SetOrientation("diagonal")
   ENDWITH

   m.loPreview.PreviewXFF(loXFF) 
   m.loPreview.show(1) 

ENDIF