Watermarker
Inheritance: java.lang.Object
public class Watermarker
Provides methods intended to insert watermarks into the documents.
Methods
setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage)
public static void setImage(InputStream inputStream, OutputStream outputStream, int saveFormat, BufferedImage watermarkImage)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
watermarkImage | java.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:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
watermarkImage | java.awt.image.BufferedImage | |
options | ImageWatermarkOptions |
setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName)
public static void setImage(String inputFileName, String outputFileName, int saveFormat, String watermarkImageFileName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
watermarkImageFileName | java.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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
watermarkImageFileName | java.lang.String | |
options | ImageWatermarkOptions |
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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
watermarkImageFileName | java.lang.String | Image 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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
watermarkImageFileName | java.lang.String | Image that is displayed as a watermark. |
options | ImageWatermarkOptions | Defines 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:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
watermarkText | java.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:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
watermarkText | java.lang.String | |
options | TextWatermarkOptions |
setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText)
public static void setText(String inputFileName, String outputFileName, int saveFormat, String watermarkText)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
watermarkText | java.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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
watermarkText | java.lang.String | |
options | TextWatermarkOptions |
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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
watermarkText | java.lang.String | Text 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:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
watermarkText | java.lang.String | Text that is displayed as a watermark. |
options | TextWatermarkOptions | Defines additional options for the text watermark. |