Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

PDFKit.Watermark

Adds a watermark to a page.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
PDFKit 2.7 Yes No Yes, macOS only No No

MBS( "PDFKit.Watermark"; PDF; PageNumber; Image; Transparency; X; Y { ; W; H; Background; DeltaX; DeltaY } )

Parameters

Parameter Description Example value
PDF A PDF reference from PDFKit.Open. $pdf
PageNumber The page number of the page to modify. 0
Image The image to be used for watermark. Should be a PNG with mask for best results. Pass a container value. $image
Transparency The transparency level. From 0.0 (opaque) to 1.0 (full transparency). 0.5
X X coordinate. If zero, the plugin will center the image. If negative, this value is the distance from right side. 0
Y Y coordinate. As with all PDF coordinates, the 0 coordinate is on the bottom of the page. If zero, the plugin will center the image. If negative, this value is the distance from top side. 0
W Optional
Desired width. If value is zero or not provided, the plugin will use the image width.
0
H Optional
Desired height. If value is zero or not provided, the plugin will use the image height.
0
Background Optional
Wether to put image in foreground or background. Default is foreground. Can be 1 for background or 0 for foreground. Does not work if existing page clears background with background color!
0
DeltaX Optional
Additional positioning offset to be added after the calculations for above are done.
0
DeltaY Optional
Additional positioning offset to be added after the calculations for above are done.
0

Result

Returns OK or error message.

Description

Adds a watermark to a page.
This modifies an in memory PDF Document which you can create by opening one using PDFKit.Open, PDFKit.OpenContainer, PDFKit.OpenPath or PDFKit.OpenURL.
You can watermark several pages by calling this function in a loop.
Don't forget to use PDFKit.Release to later release memory.
You can do similar with DynaPDF with insert image command (DynaPDF.InsertImage) and alpha set (DynaPDF.SetAlpha).

Your changes are only done in memory, so please remember to write modified pdf back to disk, e.g. by using PDFKit.WriteToPath. Or use PDFKit.GetPDFDocument to get a PDF for storing in a container.

Examples

Watermark with an image over full page:

MBS("PDFKit.Watermark"; $pdf; 0; Watermark PDF Page::WatermarkImage; 0; 0; 0; 0; 0)

See also

Example Databases


PDFKit.SetPrintSetting   -   PDFKit.WriteToPath

Feedback: Report problem or ask question.




Links
MBS Xojo tutorial videos