AddTextWatermark

<< Click to Display Table of Contents >>

Navigation:  Drivers API > IPXCPrinter Interface > Functions >

AddTextWatermark


 

PRO SDK Icon AddTextWatermark

 


 

The AddTextWatermark function is used to define text-based watermarks. The parameters in this function correspond to the watermark parameters available in the PDF-XChange Drivers API's GUI. Please note that declarations and parameters are case-sensitive:

 

 

Declaration

 

C#

 

void AddTextWatermark(

  string sName,

  string sText,

  string sFontName,

  int dwFontWeight,

  int bItalic,

  int bOutline,

  int nFontSize,

  int nLineWidth,

  int nTextcolor,

  int dwAlign,

  int xOffset,

  int yOffset,

  int nAngle,

  int dwOpacity,

  int dwFlags,

  int dwPlaceType,

  string sRange);

 

C++

 

HRESULT AddTextWatermark(

  [inBSTR sName,

  [inBSTR sText,

  [inBSTR sFontName,

  [inlong dwFontWeight,

  [inlong bItalic,

  [inlong bOutline,

  [inlong nFontSize,

  [inlong nLineWidth,

  [inlong nTextcolor,

  [inlong dwAlign,

  [inlong xOffset,

  [inlong yOffset,

  [inlong nAngle,

  [inlong dwOpacity,

  [inlong dwFlags,

  [inlong dwPlaceType,

  [inBSTR sRange);

 

VB

 

Sub AddTextWatermark(

  sName As String,

  sText As String,

  sFontName As String,

  dwFontWeight As Long,

  bItalic As Long,

  bOutline As Long,

  nFontSize As Long,

  nLineWidth As Long,

  nTextcolor As Long,

  dwAlign As Long,

  xOffset As Long,

  yOffset As Long,

  nAngle As Long,

  dwOpacity As Long,

  dwFlags As Long,

  dwPlaceType As Long,

  sRange As String)

 

Parameters

 

sName

Specifies the name of the new watermark. This name is used to identify the watermark in the Watermarks property. If there is already a watermark with the name specified then it will be overwritten.

 

sText

Specifies the watermark text.

 

sFontName

Specifies the watermark font. Please note that this is a required parameter.

 

dwFontWeight

Specifies the weight of the font used. The available range is 400 (normal) to 700 (bold).

 

bItalic

If this parameter is set to True then the italic variant of the font that sFontName identifies will be used.

 

bOutline

If this parameter is set to True then text is displayed as an outline. If it is set to False then text will be displayed as standard.

 

nLineWidth

Specifies the line width used when bOutline is set to True. Line width must be specified in tenths of points.

 

nFontSize

Specifies the font size in tenth of points. For example, 120 must be passed to generate 12pt text. If this parameter is set to 0 (zero) then the font size will be adjusted to fit the entire page.

 

nTextcolor

Specifies the text color used in the watermark.

 

dwAlign

Specifies the text alignment. If nFontSize is set to 0 (zero) then this parameter is ignored and watermarks are centered. The following parameters are available:

 

 

BIT

 

 

VALUE

 

DEFINITION

 

0

 

 

1

 

If this bit is used then text will align to the horizontal center.

 

1

 

 

2

 

 

If this bit is used then text will align on the right. Please note that if BIT 0 is selected then this value cannot be used. Additionally, if neither BIT 0 nor BIT 1 is set then text will align to the left.

 

 

4

 

 

16

 

If this bit is used then text will align to the vertical center.

 

5

 

 

32

 

 

If this bit is used then text will be aligned to the bottom of the page. Please note that if BIT 4 is selected then this value cannot be used. Additionally, if neither BIT 4 nor BIT 5 is used then text will align to the top of the page.

 

 

xOffset

Specifies the horizontal offset (relative to the top-left page corner) of the watermark. Values must be specified in tenths of millimeters.

 

yOffset

Specifies the vertical offset (relative to the top-left page corner) of the watermark. Values must be specified in tenths of millimeters.

 

nAngle

Specifies the watermark angle in degrees. All values from -90 to 90 are available. Positive values specify a counterclockwise rotation.

 

dwOpacity

Specifies the level of opacity used in the watermark. All values from 0 (fully transparent) to 100 (fully opaque) are available. If a value outside this range is used then the watermark will be clipped.

 

dwFlags

Specifies watermark placement and visibility. The following parameters are available and can be combined as desired:

 

 

BIT

 

 

VALUE

 

DEFINITION

 

0

 

 

1

 

This bit specifies that the parameter is not used.

 

1

 

 

2

 

 

This bit specifies that watermarks are placed as a background. If this bit is not used then watermarks will be placed in the foreground.

 

 

2

 

 

4

 

 

This bit specifies that watermarks are visible when viewed in PDF applications.

 

 

3

 

 

8

 

 

This bit specifies that watermarks are visible when documents are exported (for example as images) from the viewing application.

 

 

4

 

16

 

This bit specifies that watermarks are printed when documents are printed from the PDF application.

 

 

dwPlaceType

Specifies the pages on which the watermark is placed. The following parameters are available:

 

 

VALUE

 

DEFINITION

 

0

 

The watermark will be placed on all pages.

 

1

 

The watermark will be placed on only the first page.

 

2

 

The watermark will be placed on only the last page.

 

3

 

The watermark will be placed on only even pages.

 

4

 

The watermark will be placed on only odd pages.

 

5

 

The watermark will be placed on pages that the sRange parameter specifies. (See below).

 

sRange

This parameter is a string that defines the page range(s) onto which the watermark is placed. Available page ranges are as follows:

The page number, in order to specify a single page.

A range of pages in the format [p1]-[p100], where the pages specified are included.

A range of pages in the format [p1]- where all pages from the page specified are included.

A range of pages in the format -[p100] where all pages from the beginning of the documented to the page specified are included.

Please note that if multiple page ranges are specified then they must be delimited with either commas or semicolons.

 

For example the string: "-3, 5, 7-11, 15-" will place watermarks on pages 1, 2, 3, 5, 7, 8, 9, 10, 11 and from page 15 to the end of the document.