RectangleBuilder
Kind: class
Module/package: path_builder
SDK: pdfdancer-client-python 2.0.0
Builder class for constructing Rectangle objects with fluent interface. Provides a convenient way to create a rectangle path with a single builder.
Declaration
RectangleBuilder(client: "'PDFDancer'", page_number: 'int')
Members
__init__
__init__(self, client: "'PDFDancer'", page_number: 'int')
Initialize the rectangle builder.
Args: client: The PDFDancer instance for adding the rectangle page_number: The page number (1-indexed)
add
add(self) -> 'bool'
Build the rectangle and add it to the PDF document.
Returns: True if successful
Raises: ValidationException: If required properties are missing
at_coordinates
at_coordinates(self, x: 'float', y: 'float') -> "'RectangleBuilder'"
Set the bottom-left corner position of the rectangle.
Args: x: X coordinate on the page y: Y coordinate on the page
Returns: Self for method chaining
dash_pattern
dash_pattern(self, dash_array: 'List[float]', dash_phase: 'float' = 0.0) -> "'RectangleBuilder'"
Set a dash pattern.
Args: dash_array: List of on/off lengths (e.g., [10, 5] = 10pt on, 5pt off) dash_phase: Offset into the pattern
Returns: Self for method chaining
even_odd_fill
even_odd_fill(self, enabled: 'bool' = True) -> "'RectangleBuilder'"
Set the fill rule to even-odd (vs nonzero winding).
Args: enabled: True for even-odd, False for nonzero winding
Returns: Self for method chaining
fill_color
fill_color(self, color: 'Color') -> "'RectangleBuilder'"
Set the fill color.
Args: color: The fill color
Returns: Self for method chaining
solid
solid(self) -> "'RectangleBuilder'"
Set rectangle to solid (no dash pattern).
Returns: Self for method chaining
stroke_color
stroke_color(self, color: 'Color') -> "'RectangleBuilder'"
Set the stroke color.
Args: color: The stroke color
Returns: Self for method chaining
stroke_width
stroke_width(self, width: 'float') -> "'RectangleBuilder'"
Set the stroke width.
Args: width: The stroke width in points
Returns: Self for method chaining
with_size
with_size(self, width: 'float', height: 'float') -> "'RectangleBuilder'"
Set the dimensions of the rectangle.
Args: width: Rectangle width height: Rectangle height
Returns: Self for method chaining