PathBuilder
Kind: class
Module/package: path_builder
SDK: pdfdancer-client-python 2.0.0
Builder class for constructing Path objects with fluent interface. Allows building complex vector paths from multiple line and bezier segments. All coordinates are absolute page coordinates.
Declaration
PathBuilder(client: "'PDFDancer'", page_number: 'int')
Members
__init__
__init__(self, client: "'PDFDancer'", page_number: 'int')
Initialize the path builder with a client reference and page number.
Args: client: The PDFDancer instance for adding the path page_number: The page number (1-indexed)
add
add(self) -> 'bool'
Build the path and add it to the PDF document.
Returns: True if successful
Raises: ValidationException: If required properties are missing
add_bezier
add_bezier(self, p0: 'Point', p1: 'Point', p2: 'Point', p3: 'Point') -> "'PathBuilder'"
Add a cubic Bezier curve segment to the path.
Args: p0: Starting point p1: First control point p2: Second control point p3: Ending point
Returns: Self for method chaining
add_line
add_line(self, p0: 'Point', p1: 'Point') -> "'PathBuilder'"
Add a straight line segment to the path.
Args: p0: Starting point p1: Ending point
Returns: Self for method chaining
add_rectangle
add_rectangle(self, x: 'float', y: 'float', width: 'float', height: 'float') -> "'PathBuilder'"
Convenient method to add a rectangle as four line segments to the path.
Args: x: X coordinate of bottom-left corner y: Y coordinate of bottom-left corner width: Rectangle width height: Rectangle height
Returns: Self for method chaining
add_segment
add_segment(self, segment: 'PathSegment') -> "'PathBuilder'"
bezier_to
bezier_to(self, control1_x: 'float', control1_y: 'float', control2_x: 'float', control2_y: 'float', x: 'float', y: 'float') -> "'PathBuilder'"
circle
circle(self, center_x: 'float', center_y: 'float', radius: 'float') -> "'PathBuilder'"
close_path
close_path(self) -> "'PathBuilder'"
dash_pattern
dash_pattern(self, dash_array: 'List[float]', dash_phase: 'float' = 0.0) -> "'PathBuilder'"
Set a dash pattern for subsequent segments.
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) -> "'PathBuilder'"
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') -> "'PathBuilder'"
Set the fill color for subsequent segments.
Args: color: The fill color
Returns: Self for method chaining
line_to
line_to(self, x: 'float', y: 'float') -> "'PathBuilder'"
move_to
move_to(self, x: 'float', y: 'float') -> "'PathBuilder'"
rectangle
rectangle(self, x: 'float', y: 'float', width: 'float', height: 'float') -> "'PathBuilder'"
solid
solid(self) -> "'PathBuilder'"
Set segments to solid (no dash pattern).
Returns: Self for method chaining
stroke_color
stroke_color(self, color: 'Color') -> "'PathBuilder'"
Set the stroke color for subsequent segments.
Args: color: The stroke color
Returns: Self for method chaining
stroke_width
stroke_width(self, width: 'float') -> "'PathBuilder'"
Set the stroke width for subsequent segments.
Args: width: The stroke width in points
Returns: Self for method chaining