Foxit PDF SDK
com.foxit.sdk.pdf.WatermarkSettings Class Reference

Public Member Functions

 WatermarkSettings ()
 Constructor.

 
 WatermarkSettings (int position, float offset_x, float offset_y, int flags, float scale_x, float scale_y, float rotation, int opacity, boolean is_offset_centered, float relative_scale_to_page)
 Constructor, with parameters.
More...
 
 WatermarkSettings (WatermarkSettings settings)
 Constructor, with another watermark settings object.
More...
 
synchronized void delete ()
 Clean up related C++ resources immediately. More...
 
int getFlags ()
 Get watermark flags. More...
 
boolean getIs_offset_centered ()
 Get if true, position is invaild, and offset is the centered of the watermark. More...
 
float getOffset_x ()
 Get horizontal offset, in points. More...
 
float getOffset_y ()
 Get vertical offset, in points. More...
 
int getOpacity ()
 Get opacity in percents. More...
 
int getPosition ()
 Get watermark position. More...
 
float getRelative_scale_to_page ()
 Get relative scale to target page. More...
 
float getRotation ()
 Get rotation angle in degrees. More...
 
float getScale_x ()
 Get horizontal scale coefficient. More...
 
float getScale_y ()
 Get vertical scale coefficient. More...
 
void set (int position, float offset_x, float offset_y, int flags, float scale_x, float scale_y, float rotation, int opacity, boolean is_offset_centered, float relative_scale_to_page)
 Set value.
More...
 
void setFlags (int value)
 Set watermark flags. More...
 
void setIs_offset_centered (boolean value)
 Set if true, position is invaild, and offset is the centered of the watermark. More...
 
void setOffset_x (float value)
 Set horizontal offset, in points. More...
 
void setOffset_y (float value)
 Set vertical offset, in points. More...
 
void setOpacity (int value)
 Set opacity in percents. More...
 
void setPosition (int value)
 Set watermark position. More...
 
void setRelative_scale_to_page (float value)
 Set relative scale to target page. More...
 
void setRotation (float value)
 Set rotation angle in degrees. More...
 
void setScale_x (float value)
 Set horizontal scale coefficient. More...
 
void setScale_y (float value)
 Set vertical scale coefficient. More...
 

Static Public Attributes

static final int e_FlagASAnnot = 0x0001
 If set, the watermark will be an annotation when inserted to a PDF page.

 
static final int e_FlagASPageContents = 0x0000
 If set, the watermark will be a part of page content when inserted to a PDF page.

 
static final int e_FlagInvisible = 0x0008
 If set, do not display a watermark.

 
static final int e_FlagNoPrint = 0x0004
 If set, do not print a watermark.

 
static final int e_FlagOnTop = 0x0002
 If set, show watermark above other page content.

 
static final int e_FlagShareImageStream = 0x0010
 If set, watermarks will share one image stream if these watermarks use the same image or bitmap.

 
static final int e_FlagSharePageStream = 0x0040
 If set, watermarks will share one form xobject if these watermarks use the same page object.

 
static final int e_FlagShareTextStream = 0x0020
 If set, watermarks will share one form xobject if these watermarks use the same text and text's related properties.

 

Detailed Description

This class represents the watermark settings used to construct a watermark object from any supported resource.

此类表示和OFD水印相关的位置属性。

Constructor & Destructor Documentation

◆ WatermarkSettings() [1/2]

com.foxit.sdk.pdf.WatermarkSettings.WatermarkSettings ( int  position,
float  offset_x,
float  offset_y,
int  flags,
float  scale_x,
float  scale_y,
float  rotation,
int  opacity,
boolean  is_offset_centered,
float  relative_scale_to_page 
)

Constructor, with parameters.

Parameters
[in]positionWatermark position. Please refer to values starting from com.foxit.sdk.common.Constants.e_PosTopLeft and this should be one of these values.
[in]offset_xHorizontal offset, in points.
[in]offset_yVertical offset, in points.
[in]flagsWatermark flags. Please refer to values starting from com.foxit.sdk.pdf.WatermarkSettings.e_FlagASPageContents and this can be one or a combination of these values.
[in]scale_xHorizontal scale coefficient. It should be greater than 0.001f.
[in]scale_yVertical scale coefficient. It should be greater than 0.001f.
[in]rotationRotation angle in degrees.
[in]opacityOpacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.
[in]is_offset_centeredA boolean value which indicates whether offset is based on the watermark center. true means that the offset is based on the watermark center and the position will be ignored. false means not.

[in]relative_scale_to_pageRelative scale to target page. Valid range: from 0 to 1 (exclusive of 0). If the value is 0 or greater than 1, this feature is disabled and scale_x/scale_y will be used instead.

◆ WatermarkSettings() [2/2]

com.foxit.sdk.pdf.WatermarkSettings.WatermarkSettings ( WatermarkSettings  settings)

Constructor, with another watermark settings object.

构造函数,通过另一个水印位置属性对象。

Parameters
[in]settingsAnother watermark settings object.
[in]settings另一个水印位置属性对象。

Member Function Documentation

◆ delete()

synchronized void com.foxit.sdk.pdf.WatermarkSettings.delete ( )

Clean up related C++ resources immediately.

Returns
None.
Note
Once this function is called, current object cannot be used anymore.

◆ getFlags()

com.foxit.sdk.pdf.WatermarkSettings.getFlags ( )

Get watermark flags.

Please refer to values starting from com.foxit.sdk.pdf.WatermarkSettings.e_FlagASPageContents and this can be one or a combination of these values.

Returns
Watermark flags.

◆ getIs_offset_centered()

com.foxit.sdk.pdf.WatermarkSettings.getIs_offset_centered ( )

Get if true, position is invaild, and offset is the centered of the watermark.

Returns
If true, position is invaild, and offset is the centered of the watermark. If false, offset is relative to the position.

◆ getOffset_x()

com.foxit.sdk.pdf.WatermarkSettings.getOffset_x ( )

Get horizontal offset, in points.

Returns
Horizontal offset, in points.

◆ getOffset_y()

com.foxit.sdk.pdf.WatermarkSettings.getOffset_y ( )

Get vertical offset, in points.

Returns
Vertical offset, in points.

◆ getOpacity()

com.foxit.sdk.pdf.WatermarkSettings.getOpacity ( )

Get opacity in percents.

Returns
Opacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.

◆ getPosition()

com.foxit.sdk.pdf.WatermarkSettings.getPosition ( )

Get watermark position.

Please refer to values starting from com.foxit.sdk.common.Constants.e_PosTopLeft and this should be one of these values.

Returns
Watermark position.

◆ getRelative_scale_to_page()

com.foxit.sdk.pdf.WatermarkSettings.getRelative_scale_to_page ( )

Get relative scale to target page.

Returns
Relative scale to target page. Valid range: from 0 to 1 (exclusive of 0). If the value is 0 or greater than 1, this feature is disabled and scale_x/scale_y will be used instead. Default value: 0 (disabled).

◆ getRotation()

com.foxit.sdk.pdf.WatermarkSettings.getRotation ( )

Get rotation angle in degrees.

Returns
Rotation angle in degrees.

◆ getScale_x()

com.foxit.sdk.pdf.WatermarkSettings.getScale_x ( )

Get horizontal scale coefficient.

Returns
Horizontal scale coefficient. It should be greater than 0.001f.

◆ getScale_y()

com.foxit.sdk.pdf.WatermarkSettings.getScale_y ( )

Get vertical scale coefficient.

Returns
Vertical scale coefficient. It should be greater than 0.001f.

◆ set()

void com.foxit.sdk.pdf.WatermarkSettings.set ( int  position,
float  offset_x,
float  offset_y,
int  flags,
float  scale_x,
float  scale_y,
float  rotation,
int  opacity,
boolean  is_offset_centered,
float  relative_scale_to_page 
)

Set value.

Parameters
[in]positionWatermark position. Please refer to values starting from com.foxit.sdk.common.Constants.e_PosTopLeft and this should be one of these values.
[in]offset_xHorizontal offset, in points.
[in]offset_yVertical offset, in points.
[in]flagsWatermark flags. Please refer to values starting from com.foxit.sdk.pdf.WatermarkSettings.e_FlagASPageContents and this can be one or a combination of these values.
[in]scale_xHorizontal scale coefficient. It should be greater than 0.001f.
[in]scale_yVertical scale coefficient. It should be greater than 0.001f.
[in]rotationRotation angle in degrees.
[in]opacityOpacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.
[in]is_offset_centeredA boolean value which indicates whether offset is based on the watermark center. true means that the offset is based on the watermark center and the position will be ignored. false means not.
[in]relative_scale_to_pageRelative scale to target page. Valid range: from 0 to 1 (exclusive of 0). If the value is 0 or greater than 1, this feature is disabled and scale_x/scale_y will be used instead.
Returns
None.

◆ setFlags()

com.foxit.sdk.pdf.WatermarkSettings.setFlags ( int  value)

Set watermark flags.

Please refer to values starting from com.foxit.sdk.pdf.WatermarkSettings.e_FlagASPageContents and this can be one or a combination of these values.

Parameters
[in]valueWatermark flags.
Returns
None.

◆ setIs_offset_centered()

com.foxit.sdk.pdf.WatermarkSettings.setIs_offset_centered ( boolean  value)

Set if true, position is invaild, and offset is the centered of the watermark.

Parameters
[in]valueIf true, position is invaild, and offset is the centered of the watermark. If false, offset is relative to the position.
Returns
None.

◆ setOffset_x()

com.foxit.sdk.pdf.WatermarkSettings.setOffset_x ( float  value)

Set horizontal offset, in points.

Parameters
[in]valueHorizontal offset, in points.
Returns
None.

◆ setOffset_y()

com.foxit.sdk.pdf.WatermarkSettings.setOffset_y ( float  value)

Set vertical offset, in points.

Parameters
[in]valueVertical offset, in points.
Returns
None.

◆ setOpacity()

com.foxit.sdk.pdf.WatermarkSettings.setOpacity ( int  value)

Set opacity in percents.

Parameters
[in]valueOpacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.
Returns
None.

◆ setPosition()

com.foxit.sdk.pdf.WatermarkSettings.setPosition ( int  value)

Set watermark position.

Please refer to values starting from com.foxit.sdk.common.Constants.e_PosTopLeft and this should be one of these values.

Parameters
[in]valueWatermark position.
Returns
None.

◆ setRelative_scale_to_page()

com.foxit.sdk.pdf.WatermarkSettings.setRelative_scale_to_page ( float  value)

Set relative scale to target page.

Parameters
[in]valueRelative scale to target page. Valid range: from 0 to 1 (exclusive of 0). If the value is 0 or greater than 1, this feature is disabled and scale_x/scale_y will be used instead. Default value: 0 (disabled).
Returns
None.

◆ setRotation()

com.foxit.sdk.pdf.WatermarkSettings.setRotation ( float  value)

Set rotation angle in degrees.

Parameters
[in]valueRotation angle in degrees.
Returns
None.

◆ setScale_x()

com.foxit.sdk.pdf.WatermarkSettings.setScale_x ( float  value)

Set horizontal scale coefficient.

Parameters
[in]valueHorizontal scale coefficient. It should be greater than 0.001f.
Returns
None.

◆ setScale_y()

com.foxit.sdk.pdf.WatermarkSettings.setScale_y ( float  value)

Set vertical scale coefficient.

Parameters
[in]valueVertical scale coefficient. It should be greater than 0.001f.
Returns
None.