PDFKit.Watermark
----------------

Adds a watermark to a page.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [PDFKit](component_PDFKit.md) | [2.7](newinversion27.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

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

**MBS**( **"PDFKit.Watermark";** /\* Adds a watermark to a page. \*/  
**$PDF**; /\* A PDF reference from [PDFKit.Open](PDFKitOpen.md). \*/   
**$PageNumber**; /\* The page number of the page to modify.e.g. 0 \*/   
**$Image**; /\* The image to be used for watermark. Should be a PNG with mask for best results. Pass a container value. \*/   
**$Transparency**; /\* The transparency level. From 0.0 (opaque) to 1.0 (full transparency).e.g. 0.5 \*/   
**$X**; /\* X coordinate. If zero, the plugin will center the image. If negative, this value is the distance from right side.e.g. 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.e.g. 0 \*/   
**$W**; /\* Optional; Desired width. If value is zero or not provided, the plugin will use the image width.e.g. 0 \*/   
**$H**; /\* Optional; Desired height. If value is zero or not provided, the plugin will use the image height.e.g. 0 \*/   
**$Background**; /\* Optional; Whether 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!e.g. 0 \*/   
**$DeltaX**; /\* Optional; Additional positioning offset to be added after the calculations for above are done.e.g. 0 \*/   
**$DeltaY**) /\* Optional; Additional positioning offset to be added after the calculations for above are done.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | A PDF reference from [PDFKit.Open](PDFKitOpen.md). | $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 | Desired width. If value is zero or not provided, the plugin will use the image width. | 0 | Optional |
| H | Desired height. If value is zero or not provided, the plugin will use the image height. | 0 | Optional |
| Background | Whether 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 | Optional |
| DeltaX | Additional positioning offset to be added after the calculations for above are done. | 0 | Optional |
| DeltaY | Additional positioning offset to be added after the calculations for above are done. | 0 | Optional |

### 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](PDFKitOpen.md), [PDFKit.OpenContainer](PDFKitOpenContainer.md), [PDFKit.OpenPath](PDFKitOpenPath.md) or [PDFKit.OpenURL](PDFKitOpenURL.md).   
You can watermark several pages by calling this function in a loop.  
Don't forget to use [PDFKit.Release](PDFKitRelease.md) to later release memory.  
You can do similar with DynaPDF with insert image command ([DynaPDF.InsertImage](DynaPDFInsertImage.md)) and alpha set ([DynaPDF.SetAlpha](DynaPDFSetAlpha.md)).  
  
Your changes are only done in memory, so please remember to write modified pdf back to disk, e.g. by using [PDFKit.WriteToPath](PDFKitWriteToPath.md). Or use [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md) 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

- [DynaPDF.InsertImage](DynaPDFInsertImage.md)
- [DynaPDF.SetAlpha](DynaPDFSetAlpha.md)
- [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md)
- [PDFKit.Open](PDFKitOpen.md)
- [PDFKit.OpenContainer](PDFKitOpenContainer.md)
- [PDFKit.OpenPath](PDFKitOpenPath.md)
- [PDFKit.OpenURL](PDFKitOpenURL.md)
- [PDFKit.Release](PDFKitRelease.md)
- [PDFKit.WriteToPath](PDFKitWriteToPath.md)

### Release notes

- **Version 8.3**
    - Fixed [PDFKit.Watermark](http://www.mbsplugins.eu/PDFKitWatermark.shtml) to work better with watermarks on several pages.
- **Version 8.0**
    - Fixed bug with [PDFKit.Watermark](http://www.mbsplugins.eu/PDFKitWatermark.shtml) for High Sierra.

### Example Databases

- [Mac and iOS/PDFKit/Watermark PDF Page](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Watermark%20PDF%20Page.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 8.3pr5](https://www.mbsplugins.de/archive/2018-07-10/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.6pr4](https://www.mbsplugins.de/archive/2017-12-17/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.2pr10](https://www.mbsplugins.de/archive/2014-06-08/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.2pr7](https://www.mbsplugins.de/archive/2014-05-19/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.7fc](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin 2.7 Release notes](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_27_Releas/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.7pr2](https://www.mbsplugins.de/archive/2012-04-04/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2026, Seite 26 bis 27](https://filemaker-magazin.de/neuigkeit/4312-Die-neue-Ausgabe-FMM_202601-steht-online)

This function checks for a license.

Created 18th August 2014 , last changed 28th November 2019

  
[PDFKit.SetPrintSetting](PDFKitSetPrintSetting.md) - [PDFKit.WriteToPath](PDFKitWriteToPath.md)

[HTML Version](PDFKitWatermark.shtml)