PdfPageAnnotationCommon

Trait PdfPageAnnotationCommon 

Source
pub trait PdfPageAnnotationCommon {
Show 40 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 set_creator(&mut self, creator: &str) -> Result<(), PdfiumError>; 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 is_invisible_if_unsupported(&self) -> bool; fn set_is_invisible_if_unsupported( &mut self, is_invisible: bool, ) -> Result<(), PdfiumError>; fn is_hidden(&self) -> bool; fn set_is_hidden(&mut self, is_hidden: bool) -> Result<(), PdfiumError>; fn is_printed(&self) -> bool; fn set_is_printed(&mut self, is_printed: bool) -> Result<(), PdfiumError>; fn is_zoomable(&self) -> bool; fn set_is_zoomable(&mut self, is_zoomable: bool) -> Result<(), PdfiumError>; fn is_rotatable(&self) -> bool; fn set_is_rotatable( &mut self, is_rotatable: bool, ) -> Result<(), PdfiumError>; fn is_printable_but_not_viewable(&self) -> bool; fn set_is_printable_but_not_viewable( &mut self, is_printable_but_not_viewable: bool, ) -> Result<(), PdfiumError>; fn is_read_only(&self) -> bool; fn set_is_read_only( &mut self, is_read_only: bool, ) -> Result<(), PdfiumError>; fn is_locked(&self) -> bool; fn set_is_locked(&mut self, is_locked: bool) -> Result<(), PdfiumError>; fn is_editable(&self) -> bool; fn set_is_editable(&mut self, is_editable: bool) -> 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§

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.

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.

Source

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.

Source

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.

Source

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.

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 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.

This flag was added in PDF version 1.2.

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.

This flag was added in PDF version 1.2.

Source

fn is_printed(&self) -> bool

Returns true if this PdfPageAnnotation should be printed when the page is printed.

This can be useful, for example, for annotations representing interactive push buttons, which would serve no meaningful purpose on the printed page.

This flag was added in PDF version 1.2.

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.

This can be useful, for example, for annotations representing interactive push buttons, which would serve no meaningful purpose on the printed page.

This flag was added in PDF version 1.2.

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.

This flag was added in PDF version 1.3.

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.

This flag was added in PDF version 1.3.

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.

This flag was added in PDF version 1.3.

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.

This flag was added in PDF version 1.3.

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.

This flag was added in PDF version 1.3.

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.

This flag was added in PDF version 1.3.

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.

This flag is ignored for widget annotations; its function is subsumed by the PdfFormFieldCommon::is_read_only() flag of the associated form field.

THis flag was added in PDF version 1.3.

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.

This flag is ignored for widget annotations; its function is subsumed by the PdfFormFieldCommon::is_read_only() flag of the associated form field.

THis flag was added in PDF version 1.3.

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

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();
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.

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();

Implementors§

Source§

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