Watermarker

Inheritance: java.lang.Object

public class Watermarker

Provides methods intended to insert watermarks into the documents.

Methods

MethodDescription
setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage)
setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage, ImageWatermarkOptions options)
setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName)
setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName, ImageWatermarkOptions options)
setImage(String inputFileName, String outputFileName, String watermarkImageFileName)Adds an image watermark into the document.
setImage(String inputFileName, String outputFileName, String watermarkImageFileName, ImageWatermarkOptions options)Adds an image watermark into the document with options.
setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText)
setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText, TextWatermarkOptions options)
setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText)
setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText, TextWatermarkOptions options)
setText(String inputFileName, String outputFileName, String watermarkText)Adds a text watermark into the document.
setText(String inputFileName, String outputFileName, String watermarkText, TextWatermarkOptions options)Adds a text watermark into the document with options.

setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage)

public static void setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage)

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStream
outputStreamjava.io.OutputStream
saveFormatint
watermarkImagejava.awt.image.BufferedImage

setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage, ImageWatermarkOptions options)

public static void setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage, ImageWatermarkOptions options)

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStream
outputStreamjava.io.OutputStream
saveFormatint
watermarkImagejava.awt.image.BufferedImage
optionsImageWatermarkOptions

setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName)

public static void setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName)

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.String
outputFileNamejava.lang.String
saveFormatint
watermarkImageFileNamejava.lang.String

setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName, ImageWatermarkOptions options)

public static void setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName, ImageWatermarkOptions options)

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.String
outputFileNamejava.lang.String
saveFormatint
watermarkImageFileNamejava.lang.String
optionsImageWatermarkOptions

setImage(String inputFileName, String outputFileName, String watermarkImageFileName)

public static void setImage(String inputFileName, String outputFileName, String watermarkImageFileName)

Adds an image watermark into the document.

Examples:

Shows how to insert watermark image to the document.


 String doc = getMyDir() + "Document.docx";
 String watermarkImage = getImageDir() + "Logo.jpg";

 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkImage.1.docx", watermarkImage);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.2.docx", SaveFormat.DOCX, watermarkImage);
 ImageWatermarkOptions options = new ImageWatermarkOptions();
 options.setScale(50.0);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.3.docx", watermarkImage, options);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.4.docx", SaveFormat.DOCX, watermarkImage, options);
 

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.StringThe input file name.
outputFileNamejava.lang.StringThe output file name.
watermarkImageFileNamejava.lang.StringImage that is displayed as a watermark.

setImage(String inputFileName, String outputFileName, String watermarkImageFileName, ImageWatermarkOptions options)

public static void setImage(String inputFileName, String outputFileName, String watermarkImageFileName, ImageWatermarkOptions options)

Adds an image watermark into the document with options.

Examples:

Shows how to insert watermark image to the document.


 String doc = getMyDir() + "Document.docx";
 String watermarkImage = getImageDir() + "Logo.jpg";

 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkImage.1.docx", watermarkImage);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.2.docx", SaveFormat.DOCX, watermarkImage);
 ImageWatermarkOptions options = new ImageWatermarkOptions();
 options.setScale(50.0);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.3.docx", watermarkImage, options);
 Watermarker.setImage(doc, getArtifactsDir() + "LowCode.SetWatermarkText.4.docx", SaveFormat.DOCX, watermarkImage, options);
 

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.StringThe input file name.
outputFileNamejava.lang.StringThe output file name.
watermarkImageFileNamejava.lang.StringImage that is displayed as a watermark.
optionsImageWatermarkOptionsDefines additional options for the image watermark.

setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText)

public static void setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText)

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStream
outputStreamjava.io.OutputStream
saveFormatint
watermarkTextjava.lang.String

setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText, TextWatermarkOptions options)

public static void setText(InputStream inputStream, OutputStream outputStream, int saveFormat, String watermarkText, TextWatermarkOptions options)

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStream
outputStreamjava.io.OutputStream
saveFormatint
watermarkTextjava.lang.String
optionsTextWatermarkOptions

setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText)

public static void setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText)

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.String
outputFileNamejava.lang.String
saveFormatint
watermarkTextjava.lang.String

setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText, TextWatermarkOptions options)

public static void setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText, TextWatermarkOptions options)

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.String
outputFileNamejava.lang.String
saveFormatint
watermarkTextjava.lang.String
optionsTextWatermarkOptions

setText(String inputFileName, String outputFileName, String watermarkText)

public static void setText(String inputFileName, String outputFileName, String watermarkText)

Adds a text watermark into the document.

Examples:

Shows how to insert watermark text to the document.


 String doc = getMyDir() + "Big document.docx";
 String watermarkText = "This is a watermark";

 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.1.docx", watermarkText);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.2.docx", SaveFormat.DOCX, watermarkText);
 TextWatermarkOptions options = new TextWatermarkOptions();
 options.setColor(Color.RED);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.3.docx", watermarkText, options);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.4.docx", SaveFormat.DOCX, watermarkText, options);
 

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.StringThe input file name.
outputFileNamejava.lang.StringThe output file name.
watermarkTextjava.lang.StringText that is displayed as a watermark.

setText(String inputFileName, String outputFileName, String watermarkText, TextWatermarkOptions options)

public static void setText(String inputFileName, String outputFileName, String watermarkText, TextWatermarkOptions options)

Adds a text watermark into the document with options.

Examples:

Shows how to insert watermark text to the document.


 String doc = getMyDir() + "Big document.docx";
 String watermarkText = "This is a watermark";

 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.1.docx", watermarkText);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.2.docx", SaveFormat.DOCX, watermarkText);
 TextWatermarkOptions options = new TextWatermarkOptions();
 options.setColor(Color.RED);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.3.docx", watermarkText, options);
 Watermarker.setText(doc, getArtifactsDir() + "LowCode.WatermarkText.4.docx", SaveFormat.DOCX, watermarkText, options);
 

Parameters:

ParameterTypeDescription
inputFileNamejava.lang.StringThe input file name.
outputFileNamejava.lang.StringThe output file name.
watermarkTextjava.lang.StringText that is displayed as a watermark.
optionsTextWatermarkOptionsDefines additional options for the text watermark.