Foxit PDF SDK

Instance Methods | List of all members
FSWatermark Class Reference
Inheritance diagram for FSWatermark:

## Instance Methods
(float) | - getHeight
| Get the original height of current watermark. More...
(float) | - getWidth
| Get the original width of current watermark. More...
(id) | - initWithDocument:bitmap:settings:
| Constructor, from a specified bitmap. More...
(id) | - initWithDocument:image:frame_index:settings:
| Constructor, from a specified image. More...
(id) | - initWithDocument:page:settings:
| Constructor, from a specified page. More...
(id) | - initWithDocument:text:properties:settings:
| Constructor, from specified text content. More...
(id) | - initWithOther:
| Constructor, with another watermark object. More...
(BOOL) | - insertToPage:
| Insert current watermark into a PDF page. More...
(BOOL) | - isEmpty
| Check whether current object is empty or not. More...

## Detailed Description

This class is mainly used to construct a watermark with specified parameters, and then insert it to PDF page. The watermark object can be constructed from text, bitmap or image, and PDF page.

## Method Documentation

## ◆ getHeight()

- (float) getHeight |  |  |

Get the original height of current watermark.

The original size of a watermark is based on no scaling and no rotation.

Returns
  Watermark height.

## ◆ getWidth()

- (float) getWidth |  |  |

Get the original width of current watermark.

The original size of a watermark is based on no scaling and no rotation.

Returns
  Watermark width.

## ◆ initWithDocument:bitmap:settings:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
bitmap: |  | (FSBitmap*) | bitmap
settings: |  | (FSWatermarkSettings*) | settings

Constructor, from a specified bitmap.

Parameters

  [in] | document | A valid PDF document object, for which the constructed watermark will be used.
  [in] | bitmap | A valid bitmap object used as the content of the watermark.
  [in] | settings | Watermark settings, containing layout setting.

## ◆ initWithDocument:image:frame_index:settings:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
image: |  | (FSImage*) | image
frame_index: |  | (int) | frame_index
settings: |  | (FSWatermarkSettings*) | settings

Constructor, from a specified image.

Parameters

  [in] | document | A valid PDF document object, for which the constructed watermark will be used.
  [in] | image | A valid image object. One frame of this image will be used as the content of the watermark. So, this image should contain at least one frame and the image type should not be FSImageUnknown.
  [in] | frame_index | Frame index, to specify which frame of the image will be used for the watermark. Valid range: from 0 to (count-1). count is returned by function FSImage::getFrameCount.
  [in] | settings | Watermark settings, containing layout setting.

## ◆ initWithDocument:page:settings:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
page: |  | (FSPDFPage*) | page
settings: |  | (FSWatermarkSettings*) | settings

Constructor, from a specified page.

Parameters

  [in] | document | A valid PDF document object, for which the constructed watermark will be used.
  [in] | page | A valid PDF page, whose content will be used as the content of the watermark.
  [in] | settings | Watermark settings, containing layout setting.

## ◆ initWithDocument:text:properties:settings:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
text: |  | (NSString *) | text
properties: |  | (FSWatermarkTextProperties*) | properties
settings: |  | (FSWatermarkSettings*) | settings

Constructor, from specified text content.

Parameters

  [in] | document | A valid PDF document object, for which the constructed watermark will be used.
  [in] | text | A text string. This will be used as the content of the watermark. It should not be an empty string.
  [in] | properties | Text properties for watermark.
  [in] | settings | Watermark settings, containing layout setting.

## ◆ initWithOther:()

- (id) initWithOther: |  | (FSWatermark*) | other |

Constructor, with another watermark object.

Parameters

  [in] | other | Another watermark object.

## ◆ insertToPage:()

- (BOOL) insertToPage: |  | (FSPDFPage*) | page |

Insert current watermark into a PDF page.

If current watermark is treated as page content (which is specified by flags of FSWatermarkSettings when current watermark is constructed), Foxit PDF SDK will generate content for the input PDF page by default after the watermark is inserted successfully. In this case , if user wants to render the PDF page correctly after this function has been called successfully, user is recommended to call function FSPDFPage::startParse:pause:is_reparse: with parameter is_reparse YES before rendering; otherwise, the page content may not be rendered as expected.

Parameters

  [in] | page | A PDF page, to which current watermark would be inserted. This page should belong to the same document as current watermark belongs to. And the page should have been already parsed.

Returns
  YES means success, while NO means failure.

## ◆ isEmpty()

- (BOOL) isEmpty |  |  |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  YES means current object is empty, while NO means not.