Definitions for PDF watermarks.
Definitions and functions in this module are included in fpdf_watermark_r.h and fpdf_watermark_w.h.
Module: PDFWatermark
License Identifier: PDFWatermark/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_watermark_r.h.
For License Right Writing, see fpdf_watermark_w.h.
More...
|
FS_RESULT | FSPDF_Watermark_GetCount (FSCRT_PAGE page, FS_INT32 *count) |
| Get count of watermarks in a specific page and it does not include the SDK trial watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_GetSize (FSPDF_WATERMARK watermark, FS_FLOAT *width, FS_FLOAT *height) |
| Retrieve the size (width and height) of a specific watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_CreateFromText (FSCRT_DOCUMENT document, const FSCRT_BSTR *text, const FSPDF_WATERMARK_TEXTPROPERTIES *properties, const FSPDF_WATERMARK_SETTINGS *settings, FSPDF_WATERMARK *watermark) |
| Create a text watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_CreateFromBitmap (FSCRT_DOCUMENT document, FSCRT_BITMAP bitmap, const FSPDF_WATERMARK_SETTINGS *settings, FSPDF_WATERMARK *watermark) |
| Create a bitmap watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_CreateFromImage (FSCRT_DOCUMENT document, FSCRT_IMAGE image, const FSPDF_WATERMARK_SETTINGS *settings, FSPDF_WATERMARK *watermark) |
| Create an image watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_CreateFromPage (FSCRT_DOCUMENT document, FSCRT_PAGE page, const FSPDF_WATERMARK_SETTINGS *settings, FSPDF_WATERMARK *watermark) |
| Create a page watermark. More...
|
|
FS_RESULT | FSPDF_Watermark_InsertToPage (FSPDF_WATERMARK watermark, FSCRT_PAGE page) |
| Insert a watermark into a specific page. More...
|
|
FS_RESULT | FSPDF_Watermark_Release (FSPDF_WATERMARK watermark) |
| Release a watermark object. More...
|
|
FS_RESULT | FSPDF_Page_RemoveWatermarks (FSCRT_PAGE page) |
| Remove all watermarks from a specific page. More...
|
|
FS_RESULT | FSPDF_Watermark_Remove (FSCRT_PAGE page, FS_INT32 index) |
| Remove a watermark by index from a PDF page and it does not include the SDK trial watermark. More...
|
|
Definitions for PDF watermarks.
Definitions and functions in this module are included in fpdf_watermark_r.h and fpdf_watermark_w.h.
Module: PDFWatermark
License Identifier: PDFWatermark/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_watermark_r.h.
For License Right Writing, see fpdf_watermark_w.h.
This module contains the following features:
-
1. Watermark:
-
a. Count watermarks in a specific page.
-
b. Get size from a specific watermark.
-
c. Create a watermark from a text, image, bitmap or PDF page, retrieve watermark size, insert or remove a watermark.
-
d. A watermark can be created as the content of a page directly, or be created as an annotation in a page. If create a watermark from a text, call the function::FSPDF_Watermark_CreateFromText. If create a watermark from an image, call the function FSPDF_Watermark_CreateFromImage. If create a watermark from a bitmap, call the function FSPDF_Watermark_CreateFromBitmap. If create a watermark from a PDF page, call the function FSPDF_Watermark_CreateFromPage.
-
e. Reference: it is described in section 8.4.5 of PDF Reference 1.7 about watermark annotation.
◆ FSPDF_Page_RemoveWatermarks()
FS_RESULT FSPDF_Page_RemoveWatermarks |
( |
FSCRT_PAGE |
page | ) |
|
Remove all watermarks from a specific page.
The page content should have been already parsed. And there is no need to call function FSPDF_Page_LoadAnnots at first for watermarks which are annotations.
- Parameters
-
[in] | page | Handle to a FSCRT_PAGE object which is a PDF page object. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter page is NULL.
FSCRT_ERRCODE_INVALIDTYPE if the parameter page is an invalid type.
FSCRT_ERRCODE_NOTPARSED if the parameterpage is not parsed.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term unrecoverable.
-
page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_CreateFromBitmap()
Create a bitmap watermark.
- Parameters
-
[in] | document | Handle to FSCRT_DOCUMENT object, and the PDF document object which the created watermark will be used for. |
[in] | bitmap | Handle to FSCRT_BITMAP object which is to be shown as watermark. |
[in] | settings | Pointer to a FSPDF_WATERMARK_SETTINGS structure that contains layout settings for this watermark. |
[out] | watermark | Pointer to a FSPDF_WATERMARK handle that receives the watermark handle.
If no need to use this handle any more, please call function FSPDF_Watermark_Release to release it. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, bitmap, settings, or watermark is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating watermark is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if the current PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is an invalid type.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term recoverable.
-
document: this handle is long-term partially recoverable.
-
bitmap: this handle is long-term recoverable.
-
watermark: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_CreateFromImage()
Create an image watermark.
The parameter watermark can only be set in one frame, so callers shall call FSCRT_Image_LoadFrame first to obtain a frame.
- Parameters
-
[in] | document | Handle to the FSCRT_DOCUMENT object, and a PDF document object which the created watermark will be used for. |
[in] | image | Handle to the FSCRT_IMAGE object in which a frame will be shown as a watermark . |
[in] | settings | Pointer to a FSPDF_WATERMARK_SETTINGS structure which contains layout settings for this watermark. |
[out] | watermark | Pointer to a FSPDF_WATERMARK handle that receives a watermark handle.
If no need to use this handle any more, please call function FSPDF_Watermark_Release to release it. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, image, settings, or watermark is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating watermark is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if the current PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is an invalid type.
FSCRT_ERRCODE_NOTFOUND if callers do not load any one frame of the image.
FSCRT_ERRCODE_UNRECOVERABLE if function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Note
- A image file should be released after saving a document.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term recoverable.
-
document: this handle is long-term partially recoverable.
-
image: this handle is long-term recoverable.
-
watermark: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_CreateFromPage()
Create a page watermark.
- Parameters
-
[in] | document | Handle to a FSCRT_DOCUMENT object, and a PDF document object which the created watermark will be used for. |
[in] | page | Handle to a FSCRT_PAGE object which is a PDF page shown as watermark. |
[in] | settings | Pointer to a FSPDF_WATERMARK_SETTINGS structure which contains layout settings for this watermark. |
[out] | watermark | Pointer to a FSPDF_WATERMARK handle that receives a watermark handle.
If no need to use this handle any more, please call function FSPDF_Watermark_Release to release it. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document, page, settings, or watermark is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating watermark is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if the current PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the document is an invalid type or the page is an invalid type.
FSCRT_ERRCODE_NOTPARSED if the page is not parsed when being converted to a watermark.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term unrecoverable.
-
document: this handle is long-term partially recoverable.
-
page: this handle is long-term partially recoverable.
-
watermark: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_CreateFromText()
Create a text watermark.
- Parameters
-
[in] | document | Handle to FSCRT_DOCUMENT object, and the PDF document object which the created watermark will be used for. |
[in] | text | Pointer to a text string, it should be a valid pointer to FSCRT_BSTR. It specifies the content of watermark. |
[in] | properties | Pointer to a FSPDF_WATERMARK_TEXTPROPERTIES structure containing text specific properties for this watermark. |
[in] | settings | Pointer to a FSPDF_WATERMARK_SETTINGS structure containing layout settings for this watermark. |
[out] | watermark | Pointer to a FSPDF_WATERMARK handle that receives the watermark handle.
If no need to use this handle any more, please call function FSPDF_Watermark_Release to release it. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter document, text, properties, settings, or watermark is NULL, or parameter text is empty.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating watermark is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if the current PDF module is not initialized.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is an invalid type.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term recoverable.
-
document: this handle is long-term partially recoverable.
-
watermark: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_GetCount()
Get count of watermarks in a specific page and it does not include the SDK trial watermark.
The page content should have been already parsed. And there is no need to call function FSPDF_Page_LoadAnnots at first for watermarks which are annotations.
- Parameters
-
[in] | page | Handle to a FSCRT_PAGE which is a PDF page object. |
[out] | count | Pointer to a FS_INT32 object that receives count of watermarks. If there is any error, it will be set 0. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page, or count is NULL.
FSCRT_ERRCODE_NOTPARSED if the parameterpage is not parsed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if count cannot be obtained because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is short-term.
-
page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_GetSize()
Retrieve the size (width and height) of a specific watermark.
- Parameters
-
[in] | watermark | Handle to FSPDF_WATERMARK object which is a water mark object. |
[out] | width | Pointer to a FS_FLOAT object that retrieves the width of watermark. |
[out] | height | Pointer to a FS_FLOAT object that retrieves the height of watermark. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter watermark, width, or height is NULL.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe. OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_InsertToPage()
FS_RESULT FSPDF_Watermark_InsertToPage |
( |
FSPDF_WATERMARK |
watermark, |
|
|
FSCRT_PAGE |
page |
|
) |
| |
Insert a watermark into a specific page.
The page content should have been already parsed. And there is no need to call function FSPDF_Page_LoadAnnots at first for watermarks which are annotations.
- Parameters
-
[in] | watermark | Handle to a FSPDF_WATERMARK object which is a water mark object. |
[in] | page | Handle to a FSCRT_PAGE object which is a PDF page object. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter parameter watermark, or page is NULL.
FSCRT_ERRCODE_INVALIDTYPE if the parameter page is an invalid type.
FSCRT_ERRCODE_NOTPARSED if the parameterpage is not parsed.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_Release()
FS_RESULT FSPDF_Watermark_Release |
( |
FSPDF_WATERMARK |
watermark | ) |
|
Release a watermark object.
- Parameters
-
[in] | watermark | Handle to FSPDF_WATERMARK object which is a water mark object. |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter watermark is NULL.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is not thread safe. Applications need to make sure thread safety by themselves when accessing the same objects during multi-thread environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
◆ FSPDF_Watermark_Remove()
Remove a watermark by index from a PDF page and it does not include the SDK trial watermark.
The page content should have been already parsed. And there is no need to call function FSPDF_Page_LoadAnnots at first for watermarks which are annotations.
- Parameters
-
[in] | page | Handle to a FSCRT_PAGE object which is a PDF page object. |
[in] | index | A zero-based index of watermark to be got. Range: 0 to (WatermarkCount-1). WatermarkCount is returned by function FSPDF_Watermark_GetCount with the same page |
- Returns
- FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page is NULL.
FSCRT_ERRCODE_NOTFOUND if index is out of range or there are no watermarks.
FSCRT_ERRCODE_NOTPARSED if the parameterpage is not parsed.
FSCRT_ERRCODE_UNRECOVERABLE if an unrecoverable error occurs internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or invalid memory access.
FSCRT_ERRCODE_ERROR if the watermark cannot be removed because of any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
- Attention
- Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
-
This function is long-term unrecoverable.
-
page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.