Defining a Text Watermark

<< Click to Display Table of Contents >>

Navigation:  GDI Print Directives > Watermarks >

Defining a Text Watermark

//PDFX,Watermarks.DefineText, Wname, Wtext, FontName, FontWeight, FontItalic, FontOutline, FontSize, LineWidth, TextColor, Align, Xoffset, Yoffset, Angle, Opacity, Flags, PlaceType, PageRange

Parameters

Symbol

Values

Description

Wname

string

The name to assign to the watermark definition. You'll need to refer to this name in the Watermarks.Watermarks directive to invoke it.

Wtext

string

Text that will be displayed as the watermark.

FontName

string

Name of the font.

FontWeight

400,700

Font weight specification. Possible values are 400 for normal and 700 for bold.

FontItalic

0,1

Indicates if the font should be displayed in italics. (0=normal, 1=italics)

FontOutline

0,1

Indicates if the font should be drawn as a hollow outline or solid. (0=solid, 1=outline) Also see LineWidth.

FontSize

integer

Requested size of the watermark font in tenths of points (360 = 36.0 points). Set to 0 to scale the font to fill the entire page.

LineWidth

integer

Specifies the width of the contour of the outlined text, in tenths of points. Applies only when FontOutline is True.

TextColor

Integer (RGB)

RGB value indicating the color of the watermark. Use A-ShellBASIC standard hex notation &hBBGGRR (e.g. &h000080 is a medium red).

Align

Integer (sum)

Specifies alignment options and applies only when the FontSize is not zero. Combine zero or more of the following options:

 

&h0001

Horizontal Center align

 

&h0002

Right align. (If used with &h0001 the result is Left alignment)

 

&h0010

Vertical center align

 

&h0020

Bottom align. (If combined with &h0010, result is Top alignment)

 

 

 

 

xOffset, yOffset

integer

Specify the horizontal and vertical offsets from the upper left corner of the page, in tenths of millimeters. Ignored when FontSize is zero.

Angle

-90 to 90

Specifies the rotation of the text, from 90 (vertical, bottom to top), to -90 (vertical, top to bottom). 0 is horizontal.

Opacity

0 to 100

Specifies the opacity level of the watermark, from 0 (fully transparent) to 100 (fully opaque).

Flags

Integer (sum)

Indicates options relating to the placement and visibility of the watermark, and may combine zero or more of the following:

 

&h0002

Place watermark as page background, else as foreground.

 

&h0004

Watermark should be visible in the PDF viewer

 

&h0008

Watermark should be visible when exported (for example as an image format) from the viewing application.

 

&h0010

Watermark should be printed when the document is printed from the PDF viewing application.

PlaceType

Integer (one of)

Specifies which pages should contain the watermark, from the following choices:

 

0

All pages

 

1

First page only

 

2

Last page only

 

3

Even pages only

 

4

Odd pages only

 

5

Range of pages as specified by the PageRange parameter

PageRange

string

Specifies a quoted, comma-separated list of pages to contain the watermark, where each element of the list can be either a single page number or a range p1-p2. If p1 is omitted, the range starts at the first page. If p2 is omitted, it continues to the last page. Example: "-4, 6, 8-11, 15-" would put the watermark on pages 1 to 4, 6, 8 to 11, and 15 and beyond. Applicable only when PlaceType is set to 5.

 

Examples

Definition of the text watermark shown in the example above.  It is named “WM1”, consists of the text string “TOP SECRET”, displayed in Arial font, normal weight, outline, size set to fill the page, 2.4 point contour width for the outline, color RGB(17,17,128),60 degree angle, 40% opacity, all flags (background,visible in viewer, visible when exported, visible when printed), all pages.

//PDFX,Watermarks.DefineText,WM1,TOP SECRET,Arial,400,0,1,0,24,&h801111,0,0,0,60,40,30,0

//;enable watermarks in general

//PDFX,Watermarks.Enabled,True

//;And specify this particular watermark

//PDFX,Watermarks.Watermarks,WM1

 

Note that while the definition line above may be long, and may appear wrapped in the documentation, it must be on a single line in the actual file.

Compatibility

New in PDFXv5.