pdftools_toolbox.pdf.annotations.line_annotation
Classes
|
A line annotation |
- class pdftools_toolbox.pdf.annotations.line_annotation.LineAnnotation(handle)[source]
Bases:
DrawingAnnotation
A line annotation
An annotation that draws a line on a page.
- static create(target_document: Document, start: Point, end: Point, stroke: Stroke) LineAnnotation | None [source]
Create a line annotation.
The returned line annotation is not yet part of any page. It can be added to a page’s list of annotations.
- Parameters:
targetDocument (pdftools_toolbox.pdf.document.Document) – The output document with which the returned object is associated.
start (pdftools_toolbox.geometry.real.point.Point) – The line’s start point.
end (pdftools_toolbox.geometry.real.point.Point) – The line’s end point.
stroke (pdftools_toolbox.pdf.content.stroke.Stroke) – The stroking parameters used for stroking the line. The stroking paint is used as the annotation’s main paint.
- Returns:
The newly created line annotation.
- Return type:
Optional[pdftools_toolbox.pdf.annotations.line_annotation.LineAnnotation]
- Raises:
ValueError – if the targetDocument has already been closed
ValueError – if the targetDocument is read-only
ValueError – if the stroke argument is not associated with the targetDocument
ValueError – if the stroke’s
pdftools_toolbox.pdf.content.stroke.Stroke.paint
has apdftools_toolbox.pdf.content.paint.Paint.color_space
other than a device color spaceValueError – if the stroke’s
pdftools_toolbox.pdf.content.stroke.Stroke.paint
has a non-Nonepdftools_toolbox.pdf.content.paint.Paint.transparency
withpdftools_toolbox.pdf.content.transparency.Transparency.blend_mode
other thanpdftools_toolbox.pdf.content.blend_mode.BlendMode.NORMAL
ValueError – if the stroke argument’s
pdftools_toolbox.pdf.content.stroke.Stroke.line_cap_style
is other thanpdftools_toolbox.pdf.content.line_cap_style.LineCapStyle.BUTT
ValueError – if the stroke argument’s
pdftools_toolbox.pdf.content.stroke.Stroke.line_join_style
is other thanpdftools_toolbox.pdf.content.line_join_style.LineJoinStyle.MITER
ValueError – if the stroke argument’s
pdftools_toolbox.pdf.content.stroke.Stroke.miter_limit
is other than 10ValueError – if the stroke argument’s
pdftools_toolbox.pdf.content.stroke.Stroke.dash_phase
is other than 0
- property start: Point
The line’s starting point
- Returns:
pdftools_toolbox.geometry.real.point.Point
- Raises:
StateError – if the object has already been closed
- property end: Point
The line’s ending point
- Returns:
pdftools_toolbox.geometry.real.point.Point
- Raises:
StateError – if the object has already been closed
- property start_style: LineEnding
The starting point’s style
- Returns:
pdftools_toolbox.pdf.annotations.line_ending.LineEnding
- Raises:
StateError – if the object has already been closed
- property end_style: LineEnding
The ending point’s style
- Returns:
pdftools_toolbox.pdf.annotations.line_ending.LineEnding
- Raises:
StateError – if the object has already been closed
- property line_ending_fill: Paint
The line ending filling paint
This paint applies to both the starting end the ending point.
- Returns:
pdftools_toolbox.pdf.content.paint.Paint
- Raises:
StateError – if the object has already been closed