pub trait PdfPageAnnotationCommon {
Show 21 methods
// Required methods
fn name(&self) -> Option<String>;
fn is_markup_annotation(&self) -> bool;
fn has_attachment_points(&self) -> bool;
fn bounds(&self) -> Result<PdfRect, PdfiumError>;
fn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>;
fn set_position(
&mut self,
x: PdfPoints,
y: PdfPoints,
) -> Result<(), PdfiumError>;
fn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>;
fn set_height(&mut self, width: PdfPoints) -> Result<(), PdfiumError>;
fn contents(&self) -> Option<String>;
fn set_contents(&mut self, contents: &str) -> Result<(), PdfiumError>;
fn creator(&self) -> Option<String>;
fn creation_date(&self) -> Option<String>;
fn set_creation_date(
&mut self,
date: DateTime<Utc>,
) -> Result<(), PdfiumError>;
fn modification_date(&self) -> Option<String>;
fn set_modification_date(
&mut self,
date: DateTime<Utc>,
) -> Result<(), PdfiumError>;
fn fill_color(&self) -> Result<PdfColor, PdfiumError>;
fn set_fill_color(
&mut self,
fill_color: PdfColor,
) -> Result<(), PdfiumError>;
fn stroke_color(&self) -> Result<PdfColor, PdfiumError>;
fn set_stroke_color(
&mut self,
stroke_color: PdfColor,
) -> Result<(), PdfiumError>;
fn objects(&self) -> &PdfPageAnnotationObjects<'_>;
fn attachment_points(&self) -> &PdfPageAnnotationAttachmentPoints<'_>;
}Expand description
Functionality common to all PdfPageAnnotation objects, regardless of their PdfPageAnnotationType.
Required Methods§
sourcefn name(&self) -> Option<String>
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.
sourcefn is_markup_annotation(&self) -> bool
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.
sourcefn has_attachment_points(&self) -> bool
fn has_attachment_points(&self) -> bool
Returns true if this PdfPageAnnotation supports setting attachment points that
visually associate it with a PdfPageObject.
sourcefn bounds(&self) -> Result<PdfRect, PdfiumError>
fn bounds(&self) -> Result<PdfRect, PdfiumError>
Returns the bounding box of this PdfPageAnnotation.
sourcefn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>
fn set_bounds(&mut self, bounds: PdfRect) -> Result<(), PdfiumError>
Sets the bounding box of this PdfPageAnnotation.
This sets the position, the width, and the height of the annotation in a single operation. To set these properties separately, use the PdfPageAnnotationCommon::set_position(), PdfPageAnnotationCommon::set_width(), and PdfPageAnnotationCommon::set_height() functions.
sourcefn set_position(
&mut self,
x: PdfPoints,
y: PdfPoints,
) -> Result<(), PdfiumError>
fn set_position( &mut self, x: PdfPoints, y: PdfPoints, ) -> Result<(), PdfiumError>
Sets the bottom right corner of this PdfPageAnnotation to the given values.
To set the position, the width, and the height of the annotation in a single operation, use the PdfPageAnnotationCommon::set_bounds() function.
sourcefn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
fn set_width(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
Sets the width of this PdfPageAnnotation to the given value.
To set the position, the width, and the height of the annotation in a single operation, use the PdfPageAnnotationCommon::set_bounds() function.
sourcefn set_height(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
fn set_height(&mut self, width: PdfPoints) -> Result<(), PdfiumError>
Sets the height of this PdfPageAnnotation to the given value.
To set the position, the width, and the height of the annotation in a single operation, use the PdfPageAnnotationCommon::set_bounds() function.
sourcefn contents(&self) -> Option<String>
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.
sourcefn set_contents(&mut self, contents: &str) -> Result<(), PdfiumError>
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.
sourcefn creator(&self) -> Option<String>
fn creator(&self) -> Option<String>
Returns the name of the creator of this PdfPageAnnotation, if any.
sourcefn creation_date(&self) -> Option<String>
fn creation_date(&self) -> Option<String>
Returns the date and time when this PdfPageAnnotation was originally created, if any.
sourcefn set_creation_date(&mut self, date: DateTime<Utc>) -> Result<(), PdfiumError>
fn set_creation_date(&mut self, date: DateTime<Utc>) -> Result<(), PdfiumError>
Sets the date and time when this PdfPageAnnotation was originally created.
sourcefn modification_date(&self) -> Option<String>
fn modification_date(&self) -> Option<String>
Returns the date and time when this PdfPageAnnotation was last modified, if any.
sourcefn set_modification_date(
&mut self,
date: DateTime<Utc>,
) -> Result<(), PdfiumError>
fn set_modification_date( &mut self, date: DateTime<Utc>, ) -> Result<(), PdfiumError>
Sets the date and time when this PdfPageAnnotation was last modified.
sourcefn fill_color(&self) -> Result<PdfColor, PdfiumError>
fn fill_color(&self) -> Result<PdfColor, PdfiumError>
Returns the color of any filled paths in this PdfPageAnnotation.
sourcefn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
fn set_fill_color(&mut self, fill_color: PdfColor) -> Result<(), PdfiumError>
Sets the color of any filled paths in this PdfPageAnnotation.
sourcefn stroke_color(&self) -> Result<PdfColor, PdfiumError>
fn stroke_color(&self) -> Result<PdfColor, PdfiumError>
Returns the color of any stroked paths in this PdfPageAnnotation.
sourcefn set_stroke_color(
&mut self,
stroke_color: PdfColor,
) -> Result<(), PdfiumError>
fn set_stroke_color( &mut self, stroke_color: PdfColor, ) -> Result<(), PdfiumError>
Sets the color of any stroked paths in this PdfPageAnnotation.
sourcefn objects(&self) -> &PdfPageAnnotationObjects<'_>
fn objects(&self) -> &PdfPageAnnotationObjects<'_>
Returns an immutable collection of all the page objects in this PdfPageAnnotation.
Page objects can be retrieved from any type of PdfPageAnnotation, but Pdfium currently only permits adding new page objects to, or removing existing page objects from, annotations of types PdfPageAnnotationType::Ink and PdfPageAnnotationType::Stamp. All other annotation types are read-only.
To gain access to the mutable collection of page objects inside an ink or stamp annotation, you must first unwrap the annotation, like so:
annotation.as_stamp_annotation_mut().unwrap().objects_mut();sourcefn attachment_points(&self) -> &PdfPageAnnotationAttachmentPoints<'_>
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.
This collection is provided for all annotation types, but it will always be empty
if the annotation does not support attachment points. Pdfium supports attachment points
for all markup annotations and the Link annotation, but not for any other annotation type.
The PdfPageAnnotationCommon::has_attachment_points() function will return true
if the annotation supports attachment points.
To gain access to the mutable collection of attachment points inside a supported annotation, you must first unwrap the annotation, like so:
annotation.as_link_annotation_mut().unwrap().attachment_points_mut();