You can add a watermark to your PDF files as shown in this code:
The Watermark tool is composed of 2 different elements that can be configured throught the property type: text type adds text watermarks and image type adds image-based watermarks. The image type is limited to PNG and JPG format files no bigger than 1Mb.
There is a list of default settings which can be customized, as you will see later.
With transparency you can set the opacity intensity of a watermark for both the text (as shown on the code example) and image files.
With gravity will place your watermark according different document locations. Accepted values are: North, NorthEast, NorthWest, Center, CenterEast, CenterWest, East, West, South, SouthEast, SouthWest
Also, you can define vertical_adjustment_percent and horizontal_adjustment_percent in order to move the element vertically or horizontally having as an origin the selected gravity origin.
If mosaic is set to true, will stamp a 3x3 matrix mosaic of your watermark.
rotation will stamp your watermark rotated by the specified degrees amount.
Note that this function only works with the text based watermarks. Trying to customize a font with an image will give an error.
font_family, font_style, font_size and font_color are properties to customize text font format. The font_family property changes which font will be used, the font_style property changes the text style such as bold or italic, the font_size property changes the font size, and the font_color property changes the color of the watermark text.