Enum PdfPageAnnotation

Source
pub enum PdfPageAnnotation<'a> {
Show 16 variants Circle(PdfPageCircleAnnotation<'a>), FreeText(PdfPageFreeTextAnnotation<'a>), Highlight(PdfPageHighlightAnnotation<'a>), Ink(PdfPageInkAnnotation<'a>), Link(PdfPageLinkAnnotation<'a>), Popup(PdfPagePopupAnnotation<'a>), Square(PdfPageSquareAnnotation<'a>), Squiggly(PdfPageSquigglyAnnotation<'a>), Stamp(PdfPageStampAnnotation<'a>), Strikeout(PdfPageStrikeoutAnnotation<'a>), Text(PdfPageTextAnnotation<'a>), Underline(PdfPageUnderlineAnnotation<'a>), Widget(PdfPageWidgetAnnotation<'a>), XfaWidget(PdfPageXfaWidgetAnnotation<'a>), Redacted(PdfPageRedactedAnnotation<'a>), Unsupported(PdfPageUnsupportedAnnotation<'a>),
}
Expand description

A single user annotation on a PdfPage.

Variants§

§

Circle(PdfPageCircleAnnotation<'a>)

§

FreeText(PdfPageFreeTextAnnotation<'a>)

§

Highlight(PdfPageHighlightAnnotation<'a>)

§

Ink(PdfPageInkAnnotation<'a>)

§

Popup(PdfPagePopupAnnotation<'a>)

§

Square(PdfPageSquareAnnotation<'a>)

§

Squiggly(PdfPageSquigglyAnnotation<'a>)

§

Stamp(PdfPageStampAnnotation<'a>)

§

Strikeout(PdfPageStrikeoutAnnotation<'a>)

§

Text(PdfPageTextAnnotation<'a>)

§

Underline(PdfPageUnderlineAnnotation<'a>)

§

Widget(PdfPageWidgetAnnotation<'a>)

§

XfaWidget(PdfPageXfaWidgetAnnotation<'a>)

§

Redacted(PdfPageRedactedAnnotation<'a>)

§

Unsupported(PdfPageUnsupportedAnnotation<'a>)

Common properties shared by all PdfPageAnnotation types can still be accessed for annotations not supported by Pdfium, but annotation-specific functionality will be unavailable.

Implementations§

Source§

impl<'a> PdfPageAnnotation<'a>

Source

pub fn annotation_type(&self) -> PdfPageAnnotationType

The type of this PdfPageAnnotation.

Not all PDF annotation types are supported by Pdfium. For example, Pdfium does not currently support embedded sound or movie file annotations, embedded 3D animations, or annotations containing embedded file attachments.

Pdfium currently supports creating, editing, and rendering the following types of annotations:

Source

pub fn is_supported(&self) -> bool

Returns true if Pdfium supports creating, editing, and rendering this type of PdfPageAnnotation.

Not all PDF annotation types are supported by Pdfium. For example, Pdfium does not currently support embedded sound or movie file annotations, embedded 3D animations, or annotations containing embedded file attachments.

Pdfium currently supports creating, editing, and rendering the following types of annotations:

Source

pub fn is_unsupported(&self) -> bool

Returns true if Pdfium does not support creating, editing, and rendering this type of PdfPageAnnotation.

Not all PDF annotation types are supported by Pdfium. For example, Pdfium does not currently support embedded sound or movie file annotations, embedded 3D animations, or annotations containing embedded file attachments.

Pdfium currently supports creating, editing, and rendering the following types of annotations:

Source

pub fn as_circle_annotation(&self) -> Option<&PdfPageCircleAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageCircleAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Circle.

Source

pub fn as_circle_annotation_mut( &mut self, ) -> Option<&mut PdfPageCircleAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageCircleAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Circle.

Source

pub fn as_free_text_annotation(&self) -> Option<&PdfPageFreeTextAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageFreeTextAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::FreeText.

Source

pub fn as_free_text_annotation_mut( &mut self, ) -> Option<&mut PdfPageFreeTextAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageFreeTextAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::FreeText.

Source

pub fn as_highlight_annotation(&self) -> Option<&PdfPageHighlightAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageHighlightAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Highlight.

Source

pub fn as_highlight_annotation_mut( &mut self, ) -> Option<&mut PdfPageHighlightAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageHighlightAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Highlight.

Source

pub fn as_ink_annotation(&self) -> Option<&PdfPageInkAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageInkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Ink.

Source

pub fn as_ink_annotation_mut(&mut self) -> Option<&mut PdfPageInkAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageInkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Ink.

Returns an immutable reference to the underlying PdfPageLinkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Link.

Returns a mutable reference to the underlying PdfPageLinkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Link.

Source

pub fn as_popup_annotation(&self) -> Option<&PdfPagePopupAnnotation<'_>>

Returns an immutable reference to the underlying PdfPagePopupAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Popup.

Source

pub fn as_popup_annotation_mut( &mut self, ) -> Option<&mut PdfPagePopupAnnotation<'a>>

Returns a mutable reference to the underlying PdfPagePopupAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Popup.

Source

pub fn as_square_annotation(&self) -> Option<&PdfPageSquareAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageSquareAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Square.

Source

pub fn as_square_annotation_mut( &mut self, ) -> Option<&mut PdfPageSquareAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageSquareAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Square.

Source

pub fn as_squiggly_annotation(&self) -> Option<&PdfPageSquigglyAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageSquigglyAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Squiggly.

Source

pub fn as_squiggly_annotation_mut( &mut self, ) -> Option<&mut PdfPageSquigglyAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageSquigglyAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Squiggly.

Source

pub fn as_stamp_annotation(&self) -> Option<&PdfPageStampAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageStampAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Stamp.

Source

pub fn as_stamp_annotation_mut( &mut self, ) -> Option<&mut PdfPageStampAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageStampAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Stamp.

Source

pub fn as_strikeout_annotation(&self) -> Option<&PdfPageStrikeoutAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageStrikeoutAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Strikeout.

Source

pub fn as_strikeout_annotation_mut( &mut self, ) -> Option<&mut PdfPageStrikeoutAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageStrikeoutAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Strikeout.

Source

pub fn as_text_annotation(&self) -> Option<&PdfPageTextAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageTextAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Text.

Source

pub fn as_text_annotation_mut( &mut self, ) -> Option<&mut PdfPageTextAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageTextAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Text.

Source

pub fn as_underline_annotation(&self) -> Option<&PdfPageUnderlineAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageUnderlineAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Underline.

Source

pub fn as_underline_annotation_mut( &mut self, ) -> Option<&mut PdfPageUnderlineAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageUnderlineAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Underline.

Source

pub fn as_widget_annotation(&self) -> Option<&PdfPageWidgetAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageWidgetAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Widget.

Source

pub fn as_widget_annotation_mut( &mut self, ) -> Option<&mut PdfPageWidgetAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageWidgetAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Widget.

Source

pub fn as_xfa_widget_annotation( &self, ) -> Option<&PdfPageXfaWidgetAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageXfaWidgetAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::XfaWidget.

Source

pub fn as_xfa_widget_annotation_mut( &mut self, ) -> Option<&mut PdfPageXfaWidgetAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageXfaWidgetAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::XfaWidget.

Source

pub fn as_redacted_annotation(&self) -> Option<&PdfPageRedactedAnnotation<'_>>

Returns an immutable reference to the underlying PdfPageRedactedAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Redacted.

Source

pub fn as_redacted_annotation_mut( &mut self, ) -> Option<&mut PdfPageRedactedAnnotation<'a>>

Returns a mutable reference to the underlying PdfPageRedactedAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Redacted.

Source

pub fn as_form_field(&self) -> Option<&PdfFormField<'_>>

Returns an immutable reference to the PdfFormField wrapped by this PdfPageAnnotation, if any.

Only annotations of type PdfPageAnnotationType::Widget and PdfPageAnnotationType::XfaWidget wrap form fields.

Source

pub fn as_form_field_mut(&mut self) -> Option<&mut PdfFormField<'a>>

Returns a mutable reference to the PdfFormField wrapped by this PdfPageAnnotation, if any.

Only annotations of type PdfPageAnnotationType::Widget and PdfPageAnnotationType::XfaWidget wrap form fields.

Trait Implementations§

Source§

impl<'a> Drop for PdfPageAnnotation<'a>

Source§

fn drop(&mut self)

Closes this PdfPageAnnotation, releasing held memory.

Auto Trait Implementations§

§

impl<'a> Freeze for PdfPageAnnotation<'a>

§

impl<'a> !RefUnwindSafe for PdfPageAnnotation<'a>

§

impl<'a> !Send for PdfPageAnnotation<'a>

§

impl<'a> !Sync for PdfPageAnnotation<'a>

§

impl<'a> Unpin for PdfPageAnnotation<'a>

§

impl<'a> !UnwindSafe for PdfPageAnnotation<'a>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T> PdfPageAnnotationCommon for T
where T: PdfPageAnnotationPrivate<'a>,

Source§

fn name(&self) -> Option<String>

Returns the name of this PdfPageAnnotation, if any. This is a text string uniquely identifying this annotation among all the annotations attached to the containing page.
Source§

fn is_markup_annotation(&self) -> bool

Returns true if this PdfPageAnnotation supports applying text markup to the page by setting the annotation contents using the PdfPageAnnotationCommon::set_contents() function.
Source§

fn has_attachment_points(&self) -> bool

Returns true if this PdfPageAnnotation supports setting attachment points that visually associate it with a PdfPageObject.
Source§

fn bounds(&self) -> Result<PdfRect, PdfiumError>

Returns the bounding box of this PdfPageAnnotation.
Source§

fn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>

Sets the bounding box of this PdfPageAnnotation. Read more
Source§

fn set_position( &mut self, x: PdfPoints, y: PdfPoints, ) -> Result<(), PdfiumError>

Sets the bottom right corner of this PdfPageAnnotation to the given values. Read more
Source§

fn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>

Sets the width of this PdfPageAnnotation to the given value. Read more
Source§

fn set_height(&mut self, height: PdfPoints) -> Result<(), PdfiumError>

Sets the height of this PdfPageAnnotation to the given value. Read more
Source§

fn contents(&self) -> Option<String>

Returns the text to be displayed for this PdfPageAnnotation, or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form. In either case this text is useful when extracting the document’s contents in support of accessibility to users with disabilities or for other purposes.
Source§

fn set_contents(&mut self, contents: &str) -> Result<(), PdfiumError>

Sets the text to be displayed for this PdfPageAnnotation, or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form for providing accessibility to users with disabilities or for other purposes.
Source§

fn creator(&self) -> Option<String>

Returns the name of the creator of this PdfPageAnnotation, if any.
Source§

fn set_creator(&mut self, creator: &str) -> Result<(), PdfiumError>

Sets the name of the creator of this PdfPageAnnotation.
Source§

fn creation_date(&self) -> Option<String>

Returns the date and time when this PdfPageAnnotation was originally created, if any.
Source§

fn set_creation_date(&mut self, date: DateTime<Utc>) -> Result<(), PdfiumError>

Sets the date and time when this PdfPageAnnotation was originally created.
Source§

fn modification_date(&self) -> Option<String>

Returns the date and time when this PdfPageAnnotation was last modified, if any.
Source§

fn set_modification_date( &mut self, date: DateTime<Utc>, ) -> Result<(), PdfiumError>

Sets the date and time when this PdfPageAnnotation was last modified.
Source§

fn fill_color(&self) -> Result<PdfColor, PdfiumError>

Returns the color of any filled paths in this PdfPageAnnotation.
Source§

fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>

Sets the color of any filled paths in this PdfPageAnnotation.
Source§

fn stroke_color(&self) -> Result<PdfColor, PdfiumError>

Returns the color of any stroked paths in this PdfPageAnnotation.
Source§

fn set_stroke_color( &mut self, stroke_color: PdfColor, ) -> Result<(), PdfiumError>

Sets the color of any stroked paths in this PdfPageAnnotation.
Source§

fn objects(&self) -> &PdfPageAnnotationObjects<'_>

Returns an immutable collection of all the page objects in this PdfPageAnnotation. Read more
Source§

fn attachment_points(&self) -> &PdfPageAnnotationAttachmentPoints<'_>

Returns an immutable collection of the attachment points that visually associate this PdfPageAnnotation with one or more PdfPageObject objects on this PdfPage. Read more
Source§

fn is_invisible_if_unsupported(&self) -> bool

Returns true if this PdfPageAnnotation should not be displayed to the user if it does not belong to one of the standard annotation types and no annotation handler is available that supports it.
Source§

fn set_is_invisible_if_unsupported( &mut self, is_invisible: bool, ) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation should be displayed to the user if it does not belong to one of the standard annotation types and no annotation handler is available that supports it.
Source§

fn is_hidden(&self) -> bool

Returns true if this PdfPageAnnotation should not be displayed or printed, nor allowed to interact with the user, regardless of its annotation type or whether an annotation handler is available that supports it. Read more
Source§

fn set_is_hidden(&mut self, is_hidden: bool) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation should be displayed, printed, and allowed to interact with the user, regardless of its annotation type or whether an annotation handler is available that supports it. Read more
Source§

fn is_printed(&self) -> bool

Returns true if this PdfPageAnnotation should be printed when the page is printed. Read more
Source§

fn set_is_printed(&mut self, is_printed: bool) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation should be printed when the page is printed. Read more
Source§

fn is_zoomable(&self) -> bool

Returns true if the appearance of this PdfPageAnnotation should scale to match the magnification of the page. If false, the location of the annotation on the page (defined by the upper-left corner of its annotation rectangle) will remain fixed, regardless of the page magnification. Read more
Source§

fn set_is_zoomable(&mut self, is_zoomable: bool) -> Result<(), PdfiumError>

Controls whether or not the appearance of this PdfPageAnnotation should scale to match the magnification of the page. Read more
Source§

fn is_rotatable(&self) -> bool

Returns true if the appearance of this PdfPageAnnotation should rotate to match the rotation of the page. If false, the upper-left corner of the annotation rectangle will remain in a fixed location on the page, regardless of the page rotation. Read more
Source§

fn set_is_rotatable(&mut self, is_rotatable: bool) -> Result<(), PdfiumError>

Controls whether or not the appearance of this PdfPageAnnotation should rotate to match the rotation of the page. Read more
Source§

fn is_printable_but_not_viewable(&self) -> bool

Returns true if this PdfPageAnnotation should not be displayed to, or allowed to interact with, the user. The annotation may be printed (depending on the setting of the PdfPageAnnotationCommon::is_printed() flag) but should be considered hidden for purposes of on-screen display and user interaction. Read more
Source§

fn set_is_printable_but_not_viewable( &mut self, is_printable_but_not_viewable: bool, ) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation should be displayed to, and allowed to interact with, the user. Whether or not the annotation should be printed is controlled separately by the PdfPageAnnotationCommon::set_is_printed() function. Read more
Source§

fn is_read_only(&self) -> bool

Returns true if this PdfPageAnnotation should not be allowed to interact with the user. The annotation may be displayed or printed (depending on the settings of the PdfPageAnnotationCommon::is_printed() and PdfPageAnnotationCommon::is_printable_but_not_viewable() flags) but should not respond to mouse clicks or change its appearance in response to mouse motions. Read more
Source§

fn set_is_read_only(&mut self, is_read_only: bool) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation should be allowed to interact with the user. Read more
Source§

fn is_locked(&self) -> bool

Returns true if this PdfPageAnnotation is locked. Locked annotations cannot be deleted, repositioned, or resized by the user. The content of a locked annotation may still be editable, depending on the setting of the PdfPageAnnotationCommon::is_editable() flag.
Source§

fn set_is_locked(&mut self, is_locked: bool) -> Result<(), PdfiumError>

Controls whether or not this PdfPageAnnotation is locked. Locked annotations cannot be deleted, repositioned, or resized by the user. The content of a locked annotation may still be editable, depending on the setting of the PdfPageAnnotationCommon::set_is_editable() function.
Source§

fn is_editable(&self) -> bool

Returns true if the contents of this PdfPageAnnotation can be edited by the user. This setting does not control whether or not the annotation can be deleted, repositioned, or resized; those properties are controlled by the PdfPageAnnotationCommon::is_locked() flag.
Source§

fn set_is_editable(&mut self, is_editable: bool) -> Result<(), PdfiumError>

Controls whether or not the contents of this PdfPageAnnotation can be edited by the user. This setting does not control whether or not the annotation can be deleted, repositioned, or resized; those properties are controlled by the PdfPageAnnotationCommon::set_is_locked() function.
Source§

impl<'a, T> PdfPageAnnotationVariableText<'a> for T
where T: PdfPageAnnotationPrivate<'a>,

Source§

fn font_size(&self, form: &PdfForm<'_>) -> Result<PdfPoints, PdfiumError>

Returns the size of the text in this annotation. A value of PdfPoints::ZERO indicates that the font size is determined automatically from the annotation height. See also the PdfPageAnnotationVariableText::is_font_auto_sized() function.
Source§

fn is_font_auto_sized(&self, form: &PdfForm<'_>) -> bool

Returns true if the font size for this annotation is determined automatically from the annotation height.
Source§

fn font_color(&self, form: &PdfForm<'_>) -> Result<PdfColor, PdfiumError>

Returns the color of the text in this annotation.
Source§

fn set_font_color( &mut self, form: &PdfForm<'_>, color: PdfColor, ) -> Result<(), PdfiumError>

Sets the color of the text in this annotation.
Source§

fn justification( &self, ) -> Result<PdfPageAnnotationVariableTextJustification, PdfiumError>

Returns the form of justification that should be used when displaying the text assigned to this annotation.
Source§

fn rich_text(&self) -> Option<String>

Returns the rich text string assigned to this annotation, if any. 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.