Record Class TextWatermark
java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.watermark.TextWatermark
- Record Components:
text- literal watermark text, required and nonblank during generationfontFamily- built-in or registered regular font family; required during generationfontSizePt- font size in points (1/72 inch); required and positive during generationcolor- six-digit hexadecimal RGB text color, required during generationpages- page selection, required during generationopacity- finite paint opacity between zero and one, required during generationrotationDegrees- finite counterclockwise angle in degrees, required during generation
- All Implemented Interfaces:
Watermark
public record TextWatermark(String text, String fontFamily, Double fontSizePt, String color, PageSelector pages, Double opacity, Double rotationDegrees)
extends Record
implements Watermark
Text centered behind selected pages using a built-in or registered regular font. Positioning uses
the physical page center, independently of margins and reserved zones. Text size uses points;
rotation is about the page center and positive angles rotate counterclockwise in PDF coordinates.
Opacity ranges from zero (invisible) to one (opaque).
The canonical constructor stores every value unchanged; nulls do not select defaults.
Generation requires nonblank XML-compatible text, a supported family, positive finite size, a
#RRGGBB color, nonnull page selection, opacity in [0, 1], and finite rotation. Use of(String) for a complete set of default appearance values.
-
Constructor Summary
ConstructorsConstructorDescriptionTextWatermark(String text, String fontFamily, Double fontSizePt, String color, PageSelector pages, Double opacity, Double rotationDegrees) Creates an instance of aTextWatermarkrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncolor()Returns the value of thecolorrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefontFamilyrecord component.Returns the value of thefontSizePtrecord component.final inthashCode()Returns a hash code value for this object.static TextWatermarkCreates a watermark for all pages using Helvetica, 50 pt,#B0B0B0, opacity 0.12, and a 45-degree counterclockwise rotation.opacity()Returns the value of theopacityrecord component.pages()Returns the value of thepagesrecord component.Returns the value of therotationDegreesrecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TextWatermark
public TextWatermark(String text, String fontFamily, Double fontSizePt, String color, PageSelector pages, Double opacity, Double rotationDegrees) Creates an instance of aTextWatermarkrecord class.- Parameters:
text- the value for thetextrecord componentfontFamily- the value for thefontFamilyrecord componentfontSizePt- the value for thefontSizePtrecord componentcolor- the value for thecolorrecord componentpages- the value for thepagesrecord componentopacity- the value for theopacityrecord componentrotationDegrees- the value for therotationDegreesrecord component
-
-
Method Details
-
of
Creates a watermark for all pages using Helvetica, 50 pt,#B0B0B0, opacity 0.12, and a 45-degree counterclockwise rotation. Text is checked during generation.- Parameters:
text- literal watermark text- Returns:
- watermark with default appearance and the supplied text
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
fontFamily
Returns the value of thefontFamilyrecord component.- Returns:
- the value of the
fontFamilyrecord component
-
fontSizePt
Returns the value of thefontSizePtrecord component.- Returns:
- the value of the
fontSizePtrecord component
-
color
Returns the value of thecolorrecord component.- Returns:
- the value of the
colorrecord component
-
pages
Returns the value of thepagesrecord component. -
opacity
Returns the value of theopacityrecord component. -
rotationDegrees
Returns the value of therotationDegreesrecord component.- Specified by:
rotationDegreesin interfaceWatermark- Returns:
- the value of the
rotationDegreesrecord component
-