You can add a watermark to your PDF files as shown in this code:
The Watermark tool is composed of 2 different modes that can be configured throught the property mode: text mode adds text watermarks and image mode adds image-based watermarks. The image mode 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:
These settings and more can be customized as we explain in the next sections.
pages has plenty of options to set which pages have to be stamped by a watermark. See these parameters below:
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 layer will place your watermark below or above the PDF content. It is set to above by default.
vertical_position let you set the vertical position of your watermark at the following places:
horizontal_position let you set the horizontal position of your watermark at the following places:
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.