Skip to main content

LineAnnotation

Struct LineAnnotation 

Source
pub struct LineAnnotation {
Show 17 fields pub start: (f64, f64), pub end: (f64, f64), pub line_endings: (LineEndingStyle, LineEndingStyle), pub color: Option<AnnotationColor>, pub interior_color: Option<AnnotationColor>, pub opacity: Option<f32>, pub border_style: Option<BorderStyleType>, pub line_width: Option<f32>, pub leader_line: Option<f64>, pub leader_line_offset: Option<f64>, pub leader_line_extension: Option<f64>, pub caption: bool, pub contents: Option<String>, pub caption_position: CaptionPosition, pub author: Option<String>, pub subject: Option<String>, pub flags: AnnotationFlags,
}
Expand description

A Line annotation per PDF spec Section 12.5.6.7.

Displays a single straight line on the page.

Fields§

§start: (f64, f64)

Start point (x, y)

§end: (f64, f64)

End point (x, y)

§line_endings: (LineEndingStyle, LineEndingStyle)

Line ending styles (start, end)

§color: Option<AnnotationColor>

Stroke color

§interior_color: Option<AnnotationColor>

Interior color (for filled line endings)

§opacity: Option<f32>

Opacity (0.0 = transparent, 1.0 = opaque)

§border_style: Option<BorderStyleType>

Border style type

§line_width: Option<f32>

Line width

§leader_line: Option<f64>

Leader line length (positive = extends from endpoints)

§leader_line_offset: Option<f64>

Leader line offset (distance from endpoints)

§leader_line_extension: Option<f64>

Leader line extension (beyond leader line)

§caption: bool

Whether to show caption

§contents: Option<String>

Caption content

§caption_position: CaptionPosition

Caption positioning (Inline or Top)

§author: Option<String>

Author

§subject: Option<String>

Subject

§flags: AnnotationFlags

Annotation flags

Implementations§

Source§

impl LineAnnotation

Source

pub fn new(start: (f64, f64), end: (f64, f64)) -> Self

Create a new line annotation.

Source

pub fn arrow(start: (f64, f64), end: (f64, f64)) -> Self

Create a line with arrow at the end.

Source

pub fn double_arrow(start: (f64, f64), end: (f64, f64)) -> Self

Create a double-headed arrow line.

Source

pub fn dimension(start: (f64, f64), end: (f64, f64), leader_length: f64) -> Self

Create a dimension line (with leader lines).

Source

pub fn with_line_endings( self, start: LineEndingStyle, end: LineEndingStyle, ) -> Self

Set line endings.

Source

pub fn with_stroke_color(self, r: f32, g: f32, b: f32) -> Self

Set stroke color (RGB).

Source

pub fn with_fill_color(self, r: f32, g: f32, b: f32) -> Self

Set interior color for filled line endings (RGB).

Source

pub fn with_line_width(self, width: f32) -> Self

Set line width.

Source

pub fn with_border_style(self, style: BorderStyleType) -> Self

Set border style.

Source

pub fn with_leader_line(self, length: f64) -> Self

Set leader line length.

Source

pub fn with_leader_offset(self, offset: f64) -> Self

Set leader line offset.

Source

pub fn with_caption(self, text: impl Into<String>) -> Self

Set caption text.

Source

pub fn with_caption_position(self, position: CaptionPosition) -> Self

Set caption position.

Source

pub fn with_opacity(self, opacity: f32) -> Self

Set opacity.

Source

pub fn with_author(self, author: impl Into<String>) -> Self

Set author.

Source

pub fn with_subject(self, subject: impl Into<String>) -> Self

Set subject.

Source

pub fn with_flags(self, flags: AnnotationFlags) -> Self

Set annotation flags.

Source

pub fn calculate_rect(&self) -> Rect

Calculate bounding rectangle.

Source

pub fn build(&self, _page_refs: &[ObjectRef]) -> HashMap<String, Object>

Build the annotation dictionary.

Trait Implementations§

Source§

impl Clone for LineAnnotation

Source§

fn clone(&self) -> LineAnnotation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LineAnnotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<LineAnnotation> for Annotation

Source§

fn from(line: LineAnnotation) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,