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>)
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>)
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>
impl<'a> PdfPageAnnotation<'a>
Sourcepub fn annotation_type(&self) -> PdfPageAnnotationType
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:
- PdfPageAnnotationType::Circle
- PdfPageAnnotationType::FreeText
- PdfPageAnnotationType::Highlight
- PdfPageAnnotationType::Ink
- PdfPageAnnotationType::Link
- PdfPageAnnotationType::Popup
- PdfPageAnnotationType::Redacted
- PdfPageAnnotationType::Square
- PdfPageAnnotationType::Squiggly
- PdfPageAnnotationType::Stamp
- PdfPageAnnotationType::Strikeout
- PdfPageAnnotationType::Text
- PdfPageAnnotationType::Underline
- PdfPageAnnotationType::Widget
- PdfPageAnnotationType::XfaWidget
Sourcepub fn is_supported(&self) -> bool
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:
- PdfPageAnnotationType::Circle
- PdfPageAnnotationType::FreeText
- PdfPageAnnotationType::Highlight
- PdfPageAnnotationType::Ink
- PdfPageAnnotationType::Link
- PdfPageAnnotationType::Popup
- PdfPageAnnotationType::Redacted
- PdfPageAnnotationType::Square
- PdfPageAnnotationType::Squiggly
- PdfPageAnnotationType::Stamp
- PdfPageAnnotationType::Strikeout
- PdfPageAnnotationType::Text
- PdfPageAnnotationType::Underline
- PdfPageAnnotationType::Widget
- PdfPageAnnotationType::XfaWidget
Sourcepub fn is_unsupported(&self) -> bool
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:
- PdfPageAnnotationType::Circle
- PdfPageAnnotationType::FreeText
- PdfPageAnnotationType::Highlight
- PdfPageAnnotationType::Ink
- PdfPageAnnotationType::Link
- PdfPageAnnotationType::Popup
- PdfPageAnnotationType::Redacted
- PdfPageAnnotationType::Square
- PdfPageAnnotationType::Squiggly
- PdfPageAnnotationType::Stamp
- PdfPageAnnotationType::Strikeout
- PdfPageAnnotationType::Text
- PdfPageAnnotationType::Underline
- PdfPageAnnotationType::Widget
- PdfPageAnnotationType::XfaWidget
Sourcepub fn as_circle_annotation(&self) -> Option<&PdfPageCircleAnnotation<'_>>
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.
Sourcepub fn as_circle_annotation_mut(
&mut self,
) -> Option<&mut PdfPageCircleAnnotation<'a>>
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.
Sourcepub fn as_free_text_annotation(&self) -> Option<&PdfPageFreeTextAnnotation<'_>>
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.
Sourcepub fn as_free_text_annotation_mut(
&mut self,
) -> Option<&mut PdfPageFreeTextAnnotation<'a>>
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.
Sourcepub fn as_highlight_annotation(&self) -> Option<&PdfPageHighlightAnnotation<'_>>
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.
Sourcepub fn as_highlight_annotation_mut(
&mut self,
) -> Option<&mut PdfPageHighlightAnnotation<'a>>
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.
Sourcepub fn as_ink_annotation(&self) -> Option<&PdfPageInkAnnotation<'_>>
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.
Sourcepub fn as_ink_annotation_mut(&mut self) -> Option<&mut PdfPageInkAnnotation<'a>>
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.
Sourcepub fn as_link_annotation(&self) -> Option<&PdfPageLinkAnnotation<'_>>
pub fn as_link_annotation(&self) -> Option<&PdfPageLinkAnnotation<'_>>
Returns an immutable reference to the underlying PdfPageLinkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Link.
Sourcepub fn as_link_annotation_mut(
&mut self,
) -> Option<&mut PdfPageLinkAnnotation<'a>>
pub fn as_link_annotation_mut( &mut self, ) -> Option<&mut PdfPageLinkAnnotation<'a>>
Returns a mutable reference to the underlying PdfPageLinkAnnotation for this PdfPageAnnotation, if this annotation has an annotation type of PdfPageAnnotationType::Link.
Sourcepub fn as_popup_annotation(&self) -> Option<&PdfPagePopupAnnotation<'_>>
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.
Sourcepub fn as_popup_annotation_mut(
&mut self,
) -> Option<&mut PdfPagePopupAnnotation<'a>>
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.
Sourcepub fn as_square_annotation(&self) -> Option<&PdfPageSquareAnnotation<'_>>
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.
Sourcepub fn as_square_annotation_mut(
&mut self,
) -> Option<&mut PdfPageSquareAnnotation<'a>>
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.
Sourcepub fn as_squiggly_annotation(&self) -> Option<&PdfPageSquigglyAnnotation<'_>>
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.
Sourcepub fn as_squiggly_annotation_mut(
&mut self,
) -> Option<&mut PdfPageSquigglyAnnotation<'a>>
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.
Sourcepub fn as_stamp_annotation(&self) -> Option<&PdfPageStampAnnotation<'_>>
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.
Sourcepub fn as_stamp_annotation_mut(
&mut self,
) -> Option<&mut PdfPageStampAnnotation<'a>>
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.
Sourcepub fn as_strikeout_annotation(&self) -> Option<&PdfPageStrikeoutAnnotation<'_>>
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.
Sourcepub fn as_strikeout_annotation_mut(
&mut self,
) -> Option<&mut PdfPageStrikeoutAnnotation<'a>>
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.
Sourcepub fn as_text_annotation(&self) -> Option<&PdfPageTextAnnotation<'_>>
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.
Sourcepub fn as_text_annotation_mut(
&mut self,
) -> Option<&mut PdfPageTextAnnotation<'a>>
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.
Sourcepub fn as_underline_annotation(&self) -> Option<&PdfPageUnderlineAnnotation<'_>>
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.
Sourcepub fn as_underline_annotation_mut(
&mut self,
) -> Option<&mut PdfPageUnderlineAnnotation<'a>>
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.
Sourcepub fn as_widget_annotation(&self) -> Option<&PdfPageWidgetAnnotation<'_>>
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.
Sourcepub fn as_widget_annotation_mut(
&mut self,
) -> Option<&mut PdfPageWidgetAnnotation<'a>>
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.
Sourcepub fn as_xfa_widget_annotation(
&self,
) -> Option<&PdfPageXfaWidgetAnnotation<'_>>
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.
Sourcepub fn as_xfa_widget_annotation_mut(
&mut self,
) -> Option<&mut PdfPageXfaWidgetAnnotation<'a>>
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.
Sourcepub fn as_redacted_annotation(&self) -> Option<&PdfPageRedactedAnnotation<'_>>
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.
Sourcepub fn as_redacted_annotation_mut(
&mut self,
) -> Option<&mut PdfPageRedactedAnnotation<'a>>
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.
Sourcepub fn as_form_field(&self) -> Option<&PdfFormField<'_>>
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.
Sourcepub fn as_form_field_mut(&mut self) -> Option<&mut PdfFormField<'a>>
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>
impl<'a> Drop for PdfPageAnnotation<'a>
Source§fn drop(&mut self)
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<'a, T> PdfPageAnnotationCommon for Twhere
T: PdfPageAnnotationPrivate<'a>,
impl<'a, T> PdfPageAnnotationCommon for Twhere
T: PdfPageAnnotationPrivate<'a>,
Source§fn name(&self) -> Option<String>
fn name(&self) -> Option<String>
Source§fn is_markup_annotation(&self) -> bool
fn is_markup_annotation(&self) -> bool
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
fn has_attachment_points(&self) -> bool
true if this PdfPageAnnotation supports setting attachment points that
visually associate it with a PdfPageObject.Source§fn bounds(&self) -> Result<PdfRect, PdfiumError>
fn bounds(&self) -> Result<PdfRect, PdfiumError>
Source§fn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>
fn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>
Source§fn set_position(
&mut self,
x: PdfPoints,
y: PdfPoints,
) -> Result<(), PdfiumError>
fn set_position( &mut self, x: PdfPoints, y: PdfPoints, ) -> Result<(), PdfiumError>
Source§fn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
fn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
Source§fn set_height(&mut self, height: PdfPoints) -> Result<(), PdfiumError>
fn set_height(&mut self, height: PdfPoints) -> Result<(), PdfiumError>
Source§fn contents(&self) -> Option<String>
fn contents(&self) -> Option<String>
Source§fn set_contents(&mut self, contents: &str) -> Result<(), PdfiumError>
fn set_contents(&mut self, contents: &str) -> Result<(), PdfiumError>
Source§fn creator(&self) -> Option<String>
fn creator(&self) -> Option<String>
Source§fn set_creator(&mut self, creator: &str) -> Result<(), PdfiumError>
fn set_creator(&mut self, creator: &str) -> Result<(), PdfiumError>
Source§fn creation_date(&self) -> Option<String>
fn creation_date(&self) -> Option<String>
Source§fn set_creation_date(&mut self, date: DateTime<Utc>) -> Result<(), PdfiumError>
fn set_creation_date(&mut self, date: DateTime<Utc>) -> Result<(), PdfiumError>
Source§fn modification_date(&self) -> Option<String>
fn modification_date(&self) -> Option<String>
Source§fn set_modification_date(
&mut self,
date: DateTime<Utc>,
) -> Result<(), PdfiumError>
fn set_modification_date( &mut self, date: DateTime<Utc>, ) -> Result<(), PdfiumError>
Source§fn fill_color(&self) -> Result<PdfColor, PdfiumError>
fn fill_color(&self) -> Result<PdfColor, PdfiumError>
Source§fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
Source§fn stroke_color(&self) -> Result<PdfColor, PdfiumError>
fn stroke_color(&self) -> Result<PdfColor, PdfiumError>
Source§fn set_stroke_color(
&mut self,
stroke_color: PdfColor,
) -> Result<(), PdfiumError>
fn set_stroke_color( &mut self, stroke_color: PdfColor, ) -> Result<(), PdfiumError>
Source§fn objects(&self) -> &PdfPageAnnotationObjects<'_>
fn objects(&self) -> &PdfPageAnnotationObjects<'_>
Source§fn attachment_points(&self) -> &PdfPageAnnotationAttachmentPoints<'_>
fn attachment_points(&self) -> &PdfPageAnnotationAttachmentPoints<'_>
PdfPageObject objects on this PdfPage. Read moreSource§impl<'a, T> PdfPageAnnotationVariableText<'a> for Twhere
T: PdfPageAnnotationPrivate<'a>,
impl<'a, T> PdfPageAnnotationVariableText<'a> for Twhere
T: PdfPageAnnotationPrivate<'a>,
Source§fn get_font_size(&self, form: &PdfForm<'_>) -> Result<PdfPoints, PdfiumError>
fn get_font_size(&self, form: &PdfForm<'_>) -> Result<PdfPoints, PdfiumError>
Source§fn is_font_auto_sized(&self, form: &PdfForm<'_>) -> bool
fn is_font_auto_sized(&self, form: &PdfForm<'_>) -> bool
true if the font size for this annotation is determined automatically
from the annotation height.