Class Watermarker
java.lang.Object
com.lowagie.toolbox.plugins.watermarker.Watermarker
This class is the API equivalent of the WatermarkerTool. It lets you add a text watermark to all pages of a document
given in input.
-
Constructor Summary
ConstructorsConstructorDescriptionWatermarker(byte[] input, String text, int fontsize, float opacity) The main constructor with all mandatory arguments. -
Method Summary
-
Constructor Details
-
Watermarker
public Watermarker(byte[] input, String text, int fontsize, float opacity) throws IOException, com.lowagie.text.DocumentException The main constructor with all mandatory arguments. By default, the color stays black.- Parameters:
input- the pdf content as a byte[]text- the text to write as watermarkfontsize- the fontsize of the watermarkopacity- the opacity of the watermark- Throws:
IOException- on errorcom.lowagie.text.DocumentException- on error
-
-
Method Details
-
withColor
To change the default black color by a new one.- Parameters:
color- the new color to use- Returns:
- the current builder instance
-
withFont
-
write
Write the watermark to the pdf given in entry.- Returns:
- a brand new byte[] without modifying the original one.
- Throws:
IOException- on errorcom.lowagie.text.DocumentException- on error
-