Skip to main content
Version: API v2 Preview

LineBuilder

Kind: class
Module/package: path_builder
SDK: pdfdancer-client-python 2.0.0

Builder class for constructing Line objects with fluent interface. Mirrors the Java client LineBuilder API.

Declaration

LineBuilder(client: "'PDFDancer'", page_number: 'int')

Members

__init__

__init__(self, client: "'PDFDancer'", page_number: 'int')

Initialize the line builder.

Args: client: The PDFDancer instance for adding the line page_number: The page number (1-indexed)

add

add(self) -> 'bool'

Build the line and add it to the PDF document.

Returns: True if successful

Raises: ValidationException: If required properties are missing

dash_pattern

dash_pattern(self, dash_array: 'List[float]', dash_phase: 'float' = 0.0) -> "'LineBuilder'"

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

fill_color

fill_color(self, color: 'Color') -> "'LineBuilder'"

Set the fill color.

Args: color: The fill color

Returns: Self for method chaining

from_point

from_point(self, x: 'float', y: 'float') -> "'LineBuilder'"

Set the starting point of the line (absolute page coordinates).

Args: x: X coordinate on the page y: Y coordinate on the page

Returns: Self for method chaining

solid

solid(self) -> "'LineBuilder'"

Set line to solid (no dash pattern).

Returns: Self for method chaining

stroke_color

stroke_color(self, color: 'Color') -> "'LineBuilder'"

Set the stroke color.

Args: color: The stroke color

Returns: Self for method chaining

stroke_width

stroke_width(self, width: 'float') -> "'LineBuilder'"

Set the stroke width.

Args: width: The stroke width in points

Returns: Self for method chaining

to_point

to_point(self, x: 'float', y: 'float') -> "'LineBuilder'"

Set the ending point of the line (absolute page coordinates).

Args: x: X coordinate on the page y: Y coordinate on the page

Returns: Self for method chaining

View source at af2a1171a1b9