pdftools_toolbox.pdf.content.path_generator

Classes

PathGenerator(path)

class pdftools_toolbox.pdf.content.path_generator.PathGenerator(path: Path)[source]

Bases: _NativeObject

__init__(path: Path)[source]

Create a new path generator for appending to a path.

Parameters:

path (pdftools_toolbox.pdf.content.path.Path) – the path object

move_to(target: Point) None[source]

Move the current position.

Begin a new subpath by moving the current point to the specified coordinates, omitting any connecting line segment. If the previous path construction operator in the current path was also MoveTo, the new MoveTo overrides it; no vestige of the previous MoveTo operation remains in the path.

Parameters:

target (pdftools_toolbox.geometry.real.point.Point) – the target coordinates

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

line_to(target: Point) None[source]

Draw a line.

Append a straight line segment from the current point to the target coordinates. The current position is changed to the target position.

Parameters:

target (pdftools_toolbox.geometry.real.point.Point) – the target coordinates

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

bezier_to(control_point1: Point, control_point2: Point, target: Point) None[source]

Draw a bezier curve.

Append a cubic Bézier curve to the current path. The curve extends from the current point to the target position, using controlPoint1 and controlPoint2 as the Bézier control points.

The current position is changed to the target position.

Parameters:
Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

close_subpath() None[source]

Close the current subpath.

Close the current subpath by appending a straight line segment from the current point to the starting point of the subpath. This operator terminates the current subpath; appending another segment to the current path will begin a new subpath, even if the new segment begins at the endpoint reached by the closeSubpath() operation. If the current subpath has already been closed, CloseSubpath() does nothing.

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

add_rectangle(rectangle: Rectangle) None[source]

Append a rectangle to the current path as a complete subpath.

Parameters:

rectangle (pdftools_toolbox.geometry.real.rectangle.Rectangle) – the rectangle to be added to the path

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

add_circle(center: Point, radius: float) None[source]

Append a circle to the current path as a complete subpath.

Parameters:
Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

add_ellipse(rectangle: Rectangle) None[source]

Add an ellipse to the current path as a complete subpath.

Parameters:

rectangle (pdftools_toolbox.geometry.real.rectangle.Rectangle) – the surrounding rectangle of the ellipse

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

add_arc(rectangle: Rectangle, alpha1: float, alpha2: float) None[source]

Add an elliptical arc to the current path.

Parameters:
  • rectangle (pdftools_toolbox.geometry.real.rectangle.Rectangle) – the surrounding rectangle of the ellipse

  • alpha1 (float) – the angle between the x-axis and the begin of the arc

  • alpha2 (float) – the angle between the x-axis and the end of the arc

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed

add_pie(rectangle: Rectangle, alpha1: float, alpha2: float) None[source]

Add an elliptical piece of pie to the current path as a complete subpath.

Parameters:
  • rectangle (pdftools_toolbox.geometry.real.rectangle.Rectangle) – the surrounding rectangle of the ellipse

  • alpha1 (float) – the angle between the x-axis and the begin of the arc

  • alpha2 (float) – the angle between the x-axis and the end of the arc

Raises:
  • StateError – if the object has already been closed

  • StateError – if the path object has already been closed