com.foxit.sdk.pdf.Watermark Class Reference
Inheritance diagram for com.foxit.sdk.pdf.Watermark:
com.foxit.sdk.common.Base

Public Member Functions

 Watermark (PDFDoc document, String text, WatermarkTextProperties properties, WatermarkSettings settings) throws com.foxit.sdk.PDFException
 Constructor, from specified text content. More...
 
 Watermark (PDFDoc document, Bitmap bitmap, WatermarkSettings settings) throws com.foxit.sdk.PDFException
 Constructor, from a specified bitmap. More...
 
 Watermark (PDFDoc document, Image image, int frame_index, WatermarkSettings settings) throws com.foxit.sdk.PDFException
 Constructor, from a specified image. More...
 
 Watermark (PDFDoc document, PDFPage page, WatermarkSettings settings) throws com.foxit.sdk.PDFException
 Constructor, from a specified page. More...
 
 Watermark (Watermark other)
 Constructor, with another Watermark object. More...
 
float getHeight () throws com.foxit.sdk.PDFException
 Get the original height of current watermark. More...
 
float getWidth () throws com.foxit.sdk.PDFException
 Get the original width of current watermark. More...
 
boolean insertToPage (PDFPage page) throws com.foxit.sdk.PDFException
 Insert current watermark into a PDF page. More...
 
boolean 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.

Constructor & Destructor Documentation

◆ Watermark() [1/5]

com.foxit.sdk.pdf.Watermark.Watermark ( PDFDoc  document,
String  text,
WatermarkTextProperties  properties,
WatermarkSettings  settings 
) throws com.foxit.sdk.PDFException

Constructor, from specified text content.

Parameters
documentA valid PDF document object, for which the constructed watermark will be used.
textA text string. This will be used as the content of the watermark. It should not be an empty string.
propertiesText properties for watermark.
settingsWatermark settings, containing layout setting.

◆ Watermark() [2/5]

com.foxit.sdk.pdf.Watermark.Watermark ( PDFDoc  document,
Bitmap  bitmap,
WatermarkSettings  settings 
) throws com.foxit.sdk.PDFException

Constructor, from a specified bitmap.

Parameters
documentA valid PDF document object, for which the constructed watermark will be used.
bitmapA valid Bitmap object used as the content of the watermark.
settingsWatermark settings, containing layout setting.

◆ Watermark() [3/5]

com.foxit.sdk.pdf.Watermark.Watermark ( PDFDoc  document,
Image  image,
int  frame_index,
WatermarkSettings  settings 
) throws com.foxit.sdk.PDFException

Constructor, from a specified image.

Parameters
documentA valid PDF document object, for which the constructed watermark will be used.
imageA 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 common::e_Unknown.
frame_indexFrame 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 common::Image::getFrameCount.
settingsWatermark settings, containing layout setting.

◆ Watermark() [4/5]

com.foxit.sdk.pdf.Watermark.Watermark ( PDFDoc  document,
PDFPage  page,
WatermarkSettings  settings 
) throws com.foxit.sdk.PDFException

Constructor, from a specified page.

Parameters
documentA valid PDF document object, for which the constructed watermark will be used.
pageA valid PDF page, whose content will be used as the content of the watermark.
settingsWatermark settings, containing layout setting.

◆ Watermark() [5/5]

com.foxit.sdk.pdf.Watermark.Watermark ( Watermark  other)

Constructor, with another Watermark object.

Parameters
otherAnother Watermark object.

Member Function Documentation

◆ getHeight()

float com.foxit.sdk.pdf.Watermark.getHeight ( ) throws com.foxit.sdk.PDFException

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 com.foxit.sdk.pdf.Watermark.getWidth ( ) throws com.foxit.sdk.PDFException

Get the original width of current watermark.

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

Returns
Watermark width.

◆ insertToPage()

boolean com.foxit.sdk.pdf.Watermark.insertToPage ( PDFPage  page) throws com.foxit.sdk.PDFException

Insert current watermark into a PDF page.

If current watermark is treated as page content (which is specified by WatermarkSettings::setFlags 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 pdf::PDFPage::startParse with parameter is_reparse true before rendering; otherwise, the page content may not be rendered as expected.

Parameters
pageA 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
true means success, while false means failure.

◆ isEmpty()

boolean com.foxit.sdk.pdf.Watermark.isEmpty ( )

Check whether current object is empty or not.

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

Returns
true means current object is empty, while false means not.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.