Foxit PDF SDK
foxit::pdf::WatermarkSettings Class Reference

Inherits Object.

Public Types

enum  Flags {
  e_FlagASPageContents = 0x0000, e_FlagASAnnot = 0x0001, e_FlagOnTop = 0x0002, e_FlagNoPrint = 0x0004,
  e_FlagInvisible = 0x0008, e_FlagShareImageStream = 0x0010, e_FlagShareTextStream = 0x0020, e_FlagSharePageStream = 0x0040
}
 Enumeration for watermark setting flags. More...
 

Public Member Functions

 WatermarkSettings ()
 Constructor.
 
 WatermarkSettings (const common::Position position, float offset_x, float offset_y, uint32 flags, float scale_x, float scale_y, float rotation, int opacity, bool is_offset_centered, float relative_scale_to_page)
 Constructor, with parameters. More...
 
 WatermarkSettings (const WatermarkSettings &settings)
 Constructor, with another watermark settings object. More...
 
WatermarkSettings & operator= (const WatermarkSettings &settings)
 Assign operator. More...
 
void Set (const common::Position position, float offset_x, float offset_y, uint32 flags, float scale_x, float scale_y, float rotation, int opacity, bool is_offset_centered, float relative_scale_to_page)
 Set value. More...
 

Public Attributes

uint32 flags
 Watermark flags. More...
 
bool is_offset_centered
 If true, position is invaild, and offset is the centered of the watermark. If false, offset is relative to the position.
 
float offset_x
 Horizontal offset, in points.
 
float offset_y
 Vertical offset, in points.
 
int opacity
 Opacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.
 
common::Position position
 Watermark position. More...
 
float relative_scale_to_page
 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).
 
float rotation
 Rotation angle in degrees.
 
float scale_x
 Horizontal scale coefficient. It should be greater than 0.001f.
 
float scale_y
 Vertical scale coefficient. It should be greater than 0.001f.
 

Detailed Description

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

Member Enumeration Documentation

◆ Flags

Enumeration for watermark setting flags.

Values of this enumeration can be used alone or in combination. For more details about form xobjects, please refer to Section 4.9 "Form XObjects" in <PDF Reference 1.7>.

Enumerator
e_FlagASPageContents 

If set, the watermark will be a part of page content when inserted to a PDF page.

e_FlagASAnnot 

If set, the watermark will be an annotation when inserted to a PDF page.

e_FlagOnTop 

If set, show watermark above other page content.

e_FlagNoPrint 

If set, do not print a watermark.

e_FlagInvisible 

If set, do not display a watermark.

e_FlagShareImageStream 

If set, watermarks will share one image stream if these watermarks use the same image or bitmap.

e_FlagShareTextStream 

If set, watermarks will share one form xobject if these watermarks use the same text and text's related properties.

e_FlagSharePageStream 

If set, watermarks will share one form xobject if these watermarks use the same page object.

Constructor & Destructor Documentation

◆ WatermarkSettings() [1/2]

foxit::pdf::WatermarkSettings::WatermarkSettings ( const common::Position  position,
float  offset_x,
float  offset_y,
uint32  flags,
float  scale_x,
float  scale_y,
float  rotation,
int  opacity,
bool  is_offset_centered,
float  relative_scale_to_page 
)
inlineexplicit

Constructor, with parameters.

Parameters
[in]positionWatermark position. Please refer to values starting from common::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 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]

foxit::pdf::WatermarkSettings::WatermarkSettings ( const WatermarkSettings &  settings)
inline

Constructor, with another watermark settings object.

Parameters
[in]settingsAnother watermark settings object.

Member Function Documentation

◆ operator=()

WatermarkSettings& foxit::pdf::WatermarkSettings::operator= ( const WatermarkSettings &  settings)
inline

Assign operator.

Parameters
[in]settingsAnother watermark settings object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ Set()

void foxit::pdf::WatermarkSettings::Set ( const common::Position  position,
float  offset_x,
float  offset_y,
uint32  flags,
float  scale_x,
float  scale_y,
float  rotation,
int  opacity,
bool  is_offset_centered,
float  relative_scale_to_page 
)
inline

Set value.

Parameters
[in]positionWatermark position. Please refer to values starting from common::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 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.

Member Data Documentation

◆ flags

uint32 foxit::pdf::WatermarkSettings::flags

Watermark flags.

Please refer to values starting from WatermarkSettings::e_FlagASPageContents and this can be one or a combination of these values.

◆ position

common::Position foxit::pdf::WatermarkSettings::position

Watermark position.

Please refer to values starting from common::e_PosTopLeft and this should be one of these values.