Record Class PageSpec
java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.layout.PageSpec
- Record Components:
size- portrait paper size; null becomesPageSize.A4marginsMm- outer page insets; null becomes 20 mm on every sidetopZoneMm- reserved height above body content, in millimeters; null becomes zerobottomZoneMm- reserved height below body content, in millimeters; null becomes zerodimensions- optional custom paper edges in millimetersorientation- optional orientation; null means PORTRAITsignatureZoneMm- additional reserved last-page height above the bottom zone, in millimeters; null becomes zero
public record PageSpec(PageSize size, Margins marginsMm, Double topZoneMm, Double bottomZoneMm, Double signatureZoneMm, PageDimensions dimensions, Orientation orientation)
extends Record
Physical page layout with reserved regions inside the page margins. The top zone is above the
body and the bottom zone is below it. On the last page, the signature zone sits above the bottom
zone and reduces the available body height by its own height, even if no signature is supplied.
All zones span the width remaining between left/right margins.
The constructor replaces nulls with defaults but does not check dimensions. Generation requires finite nonnegative margins/zones and positive body space on ordinary and last pages.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPageSpec(PageSize size, Margins marginsMm, Double topZoneMm, Double bottomZoneMm, Double signatureZoneMm) Preserves the original named-page constructor.PageSpec(PageSize size, Margins marginsMm, Double topZoneMm, Double bottomZoneMm, Double signatureZoneMm, PageDimensions dimensions, Orientation orientation) Replaces omitted layout properties with defaults; numeric validity is checked during PDF generation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebottomZoneMmrecord component.static PageSpecdefaults()Returns the default A4 specification.Returns the value of thedimensionsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleheightMm()Returns the value of themarginsMmrecord component.Returns the value of theorientationrecord component.Returns the value of thesignatureZoneMmrecord component.size()Returns the value of thesizerecord component.Returns the value of thetopZoneMmrecord component.final StringtoString()Returns a string representation of this record class.doublewidthMm()
-
Field Details
-
A4
A4 with 20 mm margins and zero-height reserved zones. -
LETTER
US Letter with 20 mm margins and zero-height reserved zones.
-
-
Constructor Details
-
PageSpec
public PageSpec(PageSize size, Margins marginsMm, Double topZoneMm, Double bottomZoneMm, Double signatureZoneMm, PageDimensions dimensions, Orientation orientation) Replaces omitted layout properties with defaults; numeric validity is checked during PDF generation.- Parameters:
size- paper size, or null for A4marginsMm- margins, or null for 20 mm on all sidestopZoneMm- top region height in millimeters, or null for zerobottomZoneMm- bottom region height in millimeters, or null for zerosignatureZoneMm- last-page signature region height in millimeters, or null for zerodimensions- optional custom physical edgesorientation- optional orientation
-
PageSpec
public PageSpec(PageSize size, Margins marginsMm, Double topZoneMm, Double bottomZoneMm, Double signatureZoneMm) Preserves the original named-page constructor.- Parameters:
size- named paper sizemarginsMm- outer insetstopZoneMm- top reservationbottomZoneMm- bottom reservationsignatureZoneMm- final signature reservation
-
-
Method Details
-
widthMm
public double widthMm()- Returns:
- effective physical width after custom dimensions and orientation
-
heightMm
public double heightMm()- Returns:
- effective physical height after custom dimensions and orientation
-
defaults
Returns the default A4 specification.- Returns:
A4, with 20 mm margins and no reserved zones
-
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). -
size
Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
marginsMm
Returns the value of themarginsMmrecord component.- Returns:
- the value of the
marginsMmrecord component
-
topZoneMm
Returns the value of thetopZoneMmrecord component.- Returns:
- the value of the
topZoneMmrecord component
-
bottomZoneMm
Returns the value of thebottomZoneMmrecord component.- Returns:
- the value of the
bottomZoneMmrecord component
-
signatureZoneMm
Returns the value of thesignatureZoneMmrecord component.- Returns:
- the value of the
signatureZoneMmrecord component
-
dimensions
Returns the value of thedimensionsrecord component.- Returns:
- the value of the
dimensionsrecord component
-
orientation
Returns the value of theorientationrecord component.- Returns:
- the value of the
orientationrecord component
-