Class TextBasedWatermarkServiceImpl
-
- All Implemented Interfaces:
-
com.markit.api.WatermarkService.TextBasedFileSetter
,com.markit.api.WatermarkService.TextBasedWatermarkBuilder
,com.markit.api.WatermarkService.TextBasedWatermarkPositionStepBuilder
,com.markit.api.WatermarkService.TextBasedWatermarker
public class TextBasedWatermarkServiceImpl implements WatermarkService.TextBasedFileSetter, WatermarkService.TextBasedWatermarker, WatermarkService.TextBasedWatermarkBuilder, WatermarkService.TextBasedWatermarkPositionStepBuilder
- Since:
1.0
Oleg Cheban
-
-
Constructor Summary
Constructors Constructor Description TextBasedWatermarkServiceImpl()
TextBasedWatermarkServiceImpl(Executor e)
-
Method Summary
Modifier and Type Method Description WatermarkService.TextBasedWatermarker
watermark(PDDocument document)
Sets the PDF document to be watermarked. WatermarkService.TextBasedWatermarker
watermark(Array<byte> fileBytes, FileType ft)
Sets the source file to be watermarked using a byte array. WatermarkService.TextBasedWatermarker
watermark(File file, FileType ft)
Sets the source file to be watermarked using a File object. WatermarkService.TextBasedWatermarkBuilder
withText(String text)
Sets the text to be used as the watermark. WatermarkService.TextBasedWatermarkBuilder
size(int size)
Sets the size of the watermark text. WatermarkService.TextBasedWatermarkBuilder
method(WatermarkingMethod method)
Defines the method for adding a watermark (default is OVERLAY). WatermarkService.TextBasedWatermarkPositionStepBuilder
position(WatermarkPosition position)
Defines the position of the watermark on the file. WatermarkService.TextBasedWatermarkBuilder
adjust(int x, int y)
Adjusts the position of the watermark relative to its default location. WatermarkService.TextBasedWatermarkBuilder
color(Color c)
Sets the color of the watermark. WatermarkService.TextBasedWatermarkBuilder
opacity(float opacity)
Sets the opacity of the watermark. WatermarkService.TextBasedWatermarkBuilder
dpi(int d)
Specifies the resolution for the watermark in DPI. WatermarkService.TextBasedWatermarkBuilder
addTrademark()
Adds a trademark symbol to the watermark. WatermarkService.TextBasedWatermarkBuilder
rotation(int degree)
Changes the rotation of the watermark WatermarkService.TextBasedWatermarker
and()
Adds another watermark configuration to the file. WatermarkService.TextBasedWatermarkBuilder
documentFilter(Predicate<PDDocument> predicate)
Adds a condition to filter the document when applying the watermark. WatermarkService.TextBasedWatermarkBuilder
pageFilter(Predicate<Integer> predicate)
Adds a condition to filter the page when applying the watermark. WatermarkService.TextBasedWatermarkBuilder
when(boolean condition)
Enables or disables the watermark based on a specific condition. Array<byte>
apply()
Applies the watermark to the file and returns the result as a byte array. -
-
Constructor Detail
-
TextBasedWatermarkServiceImpl
TextBasedWatermarkServiceImpl()
-
TextBasedWatermarkServiceImpl
TextBasedWatermarkServiceImpl(Executor e)
-
-
Method Detail
-
watermark
WatermarkService.TextBasedWatermarker watermark(PDDocument document)
Sets the PDF document to be watermarked.
- Parameters:
document
- The PDF document to be watermarked.
-
watermark
WatermarkService.TextBasedWatermarker watermark(Array<byte> fileBytes, FileType ft)
Sets the source file to be watermarked using a byte array.
- Parameters:
fileBytes
- The byte array representing the source file.
-
watermark
WatermarkService.TextBasedWatermarker watermark(File file, FileType ft)
Sets the source file to be watermarked using a File object.
- Parameters:
file
- The file to be watermarked.
-
withText
WatermarkService.TextBasedWatermarkBuilder withText(String text)
Sets the text to be used as the watermark.
- Parameters:
text
- The text for the watermark.
-
size
WatermarkService.TextBasedWatermarkBuilder size(int size)
Sets the size of the watermark text.
- Parameters:
size
- The font size for the watermark text.
-
method
WatermarkService.TextBasedWatermarkBuilder method(WatermarkingMethod method)
Defines the method for adding a watermark (default is OVERLAY).
-
position
WatermarkService.TextBasedWatermarkPositionStepBuilder position(WatermarkPosition position)
Defines the position of the watermark on the file.
-
adjust
WatermarkService.TextBasedWatermarkBuilder adjust(int x, int y)
Adjusts the position of the watermark relative to its default location.
- Parameters:
x
- The horizontal offset in pixels.y
- The vertical offset in pixels.
-
color
WatermarkService.TextBasedWatermarkBuilder color(Color c)
Sets the color of the watermark.
-
opacity
WatermarkService.TextBasedWatermarkBuilder opacity(float opacity)
Sets the opacity of the watermark.
- Parameters:
opacity
- The opacity value, ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
-
dpi
WatermarkService.TextBasedWatermarkBuilder dpi(int d)
Specifies the resolution for the watermark in DPI.
-
addTrademark
WatermarkService.TextBasedWatermarkBuilder addTrademark()
Adds a trademark symbol to the watermark.
-
rotation
WatermarkService.TextBasedWatermarkBuilder rotation(int degree)
Changes the rotation of the watermark
-
and
WatermarkService.TextBasedWatermarker and()
Adds another watermark configuration to the file.
- Returns:
A new instance of Watermark for configuring another watermark.
-
documentFilter
WatermarkService.TextBasedWatermarkBuilder documentFilter(Predicate<PDDocument> predicate)
Adds a condition to filter the document when applying the watermark. Only documents that meet the condition will have the watermark applied.
- Parameters:
predicate
- : A condition that takes a PDDocument as input and returns true/false.
-
pageFilter
WatermarkService.TextBasedWatermarkBuilder pageFilter(Predicate<Integer> predicate)
Adds a condition to filter the page when applying the watermark. Only pages that meet the condition will have the watermark applied.
- Parameters:
predicate
- A condition that takes a page number (Integer) as input and returns true/false.
-
when
WatermarkService.TextBasedWatermarkBuilder when(boolean condition)
Enables or disables the watermark based on a specific condition.
- Parameters:
condition
- : A boolean value that determines whether the watermark is enabled (true) or disabled (false).
-
-
-
-