Skip to main content

Annotation

Struct Annotation 

Source
pub struct Annotation {
Show 27 fields pub subtype: AnnotationType, pub rect: [f32; 4], pub contents: Option<String>, pub flags: AnnotationFlags, pub name: Option<String>, pub appearance: Option<AnnotationAppearance>, pub color: Option<Vec<f32>>, pub border: Option<AnnotationBorder>, pub action: Option<Action>, pub destination: Option<Destination>, pub subtype_data: AnnotationSubtypeData, pub mk: Option<MkDict>, pub file_spec: Option<FileSpec>, pub parent_ref: Option<ObjectId>, pub object_id: Option<ObjectId>, pub open: Option<bool>, pub ap_n_bytes: Option<Vec<u8>>, pub ap_r_bytes: Option<Vec<u8>>, pub ap_d_bytes: Option<Vec<u8>>, pub irt_ref: Option<ObjectId>, pub field_name: Option<String>, pub alternate_name: Option<String>, pub field_value: Option<String>, pub form_field_flags: Option<FormFieldFlags>, pub additional_actions: Option<AdditionalActions>, pub form_field_type: Option<FormFieldType>, pub options: Option<Vec<ChoiceOption>>,
}
Expand description

A PDF annotation parsed from a page’s /Annots array.

Fields§

§subtype: AnnotationType

The type of annotation.

§rect: [f32; 4]

Annotation rectangle in user space: [x1, y1, x2, y2].

§contents: Option<String>

Contents of the annotation (the /Contents key).

§flags: AnnotationFlags

Annotation flags (bit field from /F).

§name: Option<String>

Unique name of the annotation (from /NM).

§appearance: Option<AnnotationAppearance>

Appearance streams (from /AP).

§color: Option<Vec<f32>>

Color array (from /C).

§border: Option<AnnotationBorder>

Border specification.

§action: Option<Action>

Associated action (from /A).

§destination: Option<Destination>

Destination (from /Dest).

§subtype_data: AnnotationSubtypeData

Subtype-specific fields parsed from the annotation dictionary.

§mk: Option<MkDict>

Widget appearance characteristics (/MK).

§file_spec: Option<FileSpec>

File specification for FileAttachment annotations (/FS).

§parent_ref: Option<ObjectId>

Parent annotation reference for Popup annotations (/Parent).

§object_id: Option<ObjectId>

This annotation’s own object ID (from the indirect reference).

§open: Option<bool>

Open state for Text/Popup annotations (/Open).

§ap_n_bytes: Option<Vec<u8>>

Decoded bytes of the normal appearance stream (/AP /N), if present.

Populated during parsing. Corresponds to FPDFAnnot_GetAP() with FPDF_ANNOT_APPEARANCEMODE_NORMAL.

§ap_r_bytes: Option<Vec<u8>>

Decoded bytes of the rollover appearance stream (/AP /R), if present.

Populated during parsing. Corresponds to FPDFAnnot_GetAP() with FPDF_ANNOT_APPEARANCEMODE_ROLLOVER.

§ap_d_bytes: Option<Vec<u8>>

Decoded bytes of the down appearance stream (/AP /D), if present.

Populated during parsing. Corresponds to FPDFAnnot_GetAP() with FPDF_ANNOT_APPEARANCEMODE_DOWN.

§irt_ref: Option<ObjectId>

Object ID of the annotation referenced by /IRT (“In Reply To”), if any.

Present on annotations that are replies to another annotation. Corresponds to FPDFAnnot_GetLinkedAnnot().

§field_name: Option<String>

Partial field name from /T.

For widget annotations this is the form field name; for other annotation types it serves as the annotation title / author label. Corresponds to FPDFAnnot_GetFormFieldName().

§alternate_name: Option<String>

Alternate (user-visible) field name from /TU.

Only meaningful for widget annotations. Corresponds to FPDFAnnot_GetFormFieldAlternateName().

§field_value: Option<String>

Current field value as a string from /V.

For text fields this is the text value; for choice fields it is the selected option string; for check-box / radio-button fields it is the appearance state name. Corresponds to FPDFAnnot_GetFormFieldValue().

§form_field_flags: Option<FormFieldFlags>

Form field flags from /Ff — only meaningful for widget (form field) annotations.

Contains the field-specific flags such as read-only, required, multiline, password, etc.

Corresponds to FPDFAnnot_GetFormFieldFlags().

§additional_actions: Option<AdditionalActions>

Additional actions for Widget annotations (/AA).

Contains event-triggered JavaScript actions for form field widgets. Populated during parsing for Widget annotations. Corresponds to FPDFAnnot_GetFormAdditionalActionJavaScript().

§form_field_type: Option<FormFieldType>

Form field type from /FT (Widget annotations).

Some(Text | Button | Choice | Signature) when the annotation dictionary carries an /FT key directly; None for non-widget annotations or when /FT is inherited from the parent field.

Corresponds to FPDFAnnot_GetFormFieldType().

§options: Option<Vec<ChoiceOption>>

Choice-field options parsed from /Opt (Widget annotations with /FT Ch).

Each entry has an export_value (submitted to server) and a display_value (shown to user). None for non-choice annotations.

Corresponds to FPDFAnnot_GetOptionCount() / FPDFAnnot_GetOptionLabel().

Implementations§

Source§

impl Annotation

Source

pub fn set_rect(&mut self, rect: [f32; 4]) -> DocResult<()>

Set the annotation rectangle.

Updates the in-memory rectangle. To persist the change to a PDF file, use EditDocument::update_annotation in rpdfium-edit.

Source

pub fn annot_set_rect(&mut self, rect: [f32; 4]) -> DocResult<()>

ADR-019 alias for Self::set_rect().

Corresponds to FPDFAnnot_SetRect().

Source

pub fn set_open_state(&mut self, open: bool) -> DocResult<()>

Set the open/closed state for Text (sticky-note) and Popup annotations.

Updates the in-memory open state. To persist the change to a PDF file, use EditDocument::update_annotation in rpdfium-edit.

Source

pub fn quad_points(&self) -> Option<&[f32]>

Returns the quad points for markup annotations (Highlight, Underline, Squiggly, StrikeOut, Link, Polygon, PolyLine).

Each group of 8 values defines a quadrilateral: [x1,y1, x2,y2, x3,y3, x4,y4].

Corresponds to upstream CPDF_Annot::GetQuadPoints().

Source

pub fn annot_get_quad_points(&self) -> Option<&[f32]>

ADR-019 alias for quad_points().

Corresponds to upstream CPDF_Annot::GetQuadPoints().

Source

pub fn get_quad_points(&self) -> Option<&[f32]>

👎Deprecated since 0.1.0:

use annot_get_quad_points() instead

Deprecated: use annot_get_quad_points() instead.

Source

pub fn subtype(&self) -> AnnotationType

Returns the annotation subtype.

Corresponds to FPDFAnnot_GetSubtype().

Source

pub fn annot_get_subtype(&self) -> AnnotationType

ADR-019 alias for Self::subtype().

Corresponds to FPDFAnnot_GetSubtype().

Source

pub fn get_subtype(&self) -> AnnotationType

👎Deprecated since 0.1.0:

use annot_get_subtype() instead

Deprecated: use annot_get_subtype() instead.

Source

pub fn rect(&self) -> [f32; 4]

Returns the annotation rectangle [x1, y1, x2, y2].

Corresponds to FPDFAnnot_GetRect().

Source

pub fn annot_get_rect(&self) -> [f32; 4]

ADR-019 alias for Self::rect().

Corresponds to FPDFAnnot_GetRect().

Source

pub fn get_rect(&self) -> [f32; 4]

👎Deprecated since 0.1.0:

use annot_get_rect() instead

Deprecated: use annot_get_rect() instead.

Source

pub fn flags(&self) -> AnnotationFlags

Returns the annotation flags.

Corresponds to FPDFAnnot_GetFlags().

Source

pub fn annot_get_flags(&self) -> AnnotationFlags

ADR-019 alias for Self::flags().

Corresponds to FPDFAnnot_GetFlags().

Source

pub fn get_flags(&self) -> AnnotationFlags

👎Deprecated since 0.1.0:

use annot_get_flags() instead

Deprecated: use annot_get_flags() instead.

Source

pub fn has_attachment_points(&self) -> bool

Returns true if this annotation subtype supports attachment (quad) points.

Attachment points are supported by Highlight, Underline, Squiggly, StrikeOut, and Link annotations.

Corresponds to FPDFAnnot_HasAttachmentPoints().

Source

pub fn annot_has_attachment_points(&self) -> bool

ADR-019 alias for Self::has_attachment_points().

Corresponds to FPDFAnnot_HasAttachmentPoints().

Source

pub fn attachment_point_count(&self) -> usize

Returns the number of attachment point groups (quadrilaterals).

Each group is 8 floats [x1,y1, x2,y2, x3,y3, x4,y4].

Corresponds to FPDFAnnot_CountAttachmentPoints().

Source

pub fn annot_count_attachment_points(&self) -> usize

ADR-019 alias for Self::attachment_point_count().

Corresponds to FPDFAnnot_CountAttachmentPoints().

Source

pub fn count_attachment_points(&self) -> usize

👎Deprecated since 0.1.0:

use annot_count_attachment_points() instead

Deprecated: use annot_count_attachment_points() instead.

Source

pub fn attachment_points(&self, index: usize) -> Option<[f32; 8]>

Returns the index-th attachment point group as 8 floats, or None if the index is out of bounds.

Corresponds to FPDFAnnot_GetAttachmentPoints().

Source

pub fn annot_get_attachment_points(&self, index: usize) -> Option<[f32; 8]>

ADR-019 alias for Self::attachment_points().

Corresponds to FPDFAnnot_GetAttachmentPoints().

Source

pub fn get_attachment_points(&self, index: usize) -> Option<[f32; 8]>

👎Deprecated since 0.1.0:

use annot_get_attachment_points() instead

Deprecated: use annot_get_attachment_points() instead.

Source

pub fn vertices(&self) -> Option<&[f32]>

Returns the vertex array for Polygon and PolyLine annotations as a flat [x, y, x, y, …] slice, or None if absent.

Corresponds to FPDFAnnot_GetVertices().

Source

pub fn annot_get_vertices(&self) -> Option<&[f32]>

ADR-019 alias for Self::vertices().

Corresponds to FPDFAnnot_GetVertices().

Source

pub fn get_vertices(&self) -> Option<&[f32]>

👎Deprecated since 0.1.0:

use annot_get_vertices() instead

Deprecated: use annot_get_vertices() instead.

Source

pub fn ink_list_count(&self) -> usize

Returns the number of ink strokes for Ink annotations.

Corresponds to FPDFAnnot_GetInkListCount().

Source

pub fn annot_get_ink_list_count(&self) -> usize

ADR-019 alias for Self::ink_list_count().

Corresponds to FPDFAnnot_GetInkListCount().

Source

pub fn get_ink_list_count(&self) -> usize

👎Deprecated since 0.1.0:

use annot_get_ink_list_count() instead

Deprecated: use annot_get_ink_list_count() instead.

Source

pub fn ink_list_path(&self, index: usize) -> Option<&[f32]>

Returns the index-th ink stroke as a flat [x, y, x, y, …] slice, or None.

Corresponds to FPDFAnnot_GetInkListPath().

Source

pub fn annot_get_ink_list_path(&self, index: usize) -> Option<&[f32]>

ADR-019 alias for Self::ink_list_path().

Corresponds to FPDFAnnot_GetInkListPath().

Source

pub fn get_ink_list_path(&self, index: usize) -> Option<&[f32]>

👎Deprecated since 0.1.0:

use annot_get_ink_list_path() instead

Deprecated: use annot_get_ink_list_path() instead.

Source

pub fn line_endpoints(&self) -> Option<([f32; 2], [f32; 2])>

Returns the line endpoints for a Line annotation as two [x, y] pairs: ([x1, y1], [x2, y2]), or None if absent.

Corresponds to FPDFAnnot_GetLine().

Source

pub fn annot_get_line(&self) -> Option<([f32; 2], [f32; 2])>

ADR-019 alias for Self::line_endpoints().

Corresponds to FPDFAnnot_GetLine().

Source

pub fn get_line(&self) -> Option<([f32; 2], [f32; 2])>

👎Deprecated since 0.1.0:

use annot_get_line() instead

Deprecated: use annot_get_line() instead.

Source

pub fn get_line_endpoints(&self) -> Option<([f32; 2], [f32; 2])>

👎Deprecated since 0.1.0:

use annot_get_line() instead

Deprecated: use annot_get_line() instead.

Source

pub fn border_style(&self) -> Option<(f32, f32, f32)>

Returns the border specification as (horizontal_radius, vertical_radius, width).

Because AnnotationBorder only stores width (the /Border h/v radii are not retained), the returned tuple is always (0.0, 0.0, width).

Corresponds to FPDFAnnot_GetBorder().

Source

pub fn annot_get_border(&self) -> Option<(f32, f32, f32)>

ADR-019 alias for Self::border_style().

Corresponds to FPDFAnnot_GetBorder().

Source

pub fn get_border(&self) -> Option<(f32, f32, f32)>

👎Deprecated since 0.1.0:

use annot_get_border() instead

Deprecated: use annot_get_border() instead.

Source

pub fn get_border_style(&self) -> Option<(f32, f32, f32)>

👎Deprecated since 0.1.0:

use annot_get_border() instead

Deprecated: use annot_get_border() instead.

Source

pub fn color_rgba(&self) -> Option<(u8, u8, u8, u8)>

Returns the annotation color as (red, green, blue, alpha) in 0–255 range.

Converts from the PDF /C array (0.0–1.0 floats):

  • 1 component → gray (R=G=B=gray, A=255)
  • 3 components → RGB, A=255
  • 4 components → CMYK converted to RGB (approximate), A=255
  • other → None

Corresponds to FPDFAnnot_GetColor().

Source

pub fn annot_get_color(&self) -> Option<(u8, u8, u8, u8)>

ADR-019 alias for Self::color_rgba().

Corresponds to FPDFAnnot_GetColor().

Source

pub fn get_color(&self) -> Option<(u8, u8, u8, u8)>

👎Deprecated since 0.1.0:

use annot_get_color() instead

Deprecated: use annot_get_color() instead.

Source

pub fn get_color_rgba(&self) -> Option<(u8, u8, u8, u8)>

👎Deprecated since 0.1.0:

use annot_get_color() instead

Deprecated: use annot_get_color() instead.

Source

pub fn string_value(&self, key: &str) -> Option<&str>

Returns the string value for a well-known annotation key.

Supported keys: "Contents", "NM" (annotation name/label), "T" (partial field name), "TU" (alternate field name), "V" (current field value).

Corresponds to FPDFAnnot_GetStringValue().

Source

pub fn annot_get_string_value(&self, key: &str) -> Option<&str>

ADR-019 alias for Self::string_value().

Corresponds to FPDFAnnot_GetStringValue().

Source

pub fn get_string_value(&self, key: &str) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_string_value() instead

Deprecated: use annot_get_string_value() instead.

Source

pub fn field_name(&self) -> Option<&str>

Returns the partial field name (/T key).

For widget annotations this is the form field name; for other annotation types it serves as the annotation title / author label.

Corresponds to FPDFAnnot_GetFormFieldName().

Source

pub fn annot_get_form_field_name(&self) -> Option<&str>

ADR-019 alias for Self::field_name().

Corresponds to FPDFAnnot_GetFormFieldName().

Source

pub fn get_form_field_name(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_name() instead

Deprecated: use annot_get_form_field_name() instead.

Source

pub fn get_field_name(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_name() instead

Deprecated: use annot_get_form_field_name() instead.

Source

pub fn alternate_field_name(&self) -> Option<&str>

Returns the alternate (user-visible) field name (/TU key).

Only meaningful for widget annotations.

Corresponds to FPDFAnnot_GetFormFieldAlternateName().

Source

pub fn annot_get_form_field_alternate_name(&self) -> Option<&str>

ADR-019 alias for Self::alternate_field_name().

Corresponds to FPDFAnnot_GetFormFieldAlternateName().

Source

pub fn get_form_field_alternate_name(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_alternate_name() instead

Deprecated: use annot_get_form_field_alternate_name() instead.

Source

pub fn get_alternate_field_name(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_alternate_name() instead

Deprecated: use annot_get_form_field_alternate_name() instead.

Source

pub fn field_value_str(&self) -> Option<&str>

Returns the current field value as a string (/V key).

For text fields this is the text value; for choice fields it is the selected option string; for check-box / radio-button fields it is the appearance state name.

Corresponds to FPDFAnnot_GetFormFieldValue().

Source

pub fn annot_get_form_field_value(&self) -> Option<&str>

ADR-019 alias for Self::field_value_str().

Corresponds to FPDFAnnot_GetFormFieldValue().

Source

pub fn get_form_field_value(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_value() instead

Deprecated: use annot_get_form_field_value() instead.

Source

pub fn get_field_value(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use annot_get_form_field_value() instead

Deprecated: use annot_get_form_field_value() instead.

Source

pub fn has_key(&self, key: &str) -> bool

Returns true if this annotation has a non-None value for the given key.

Corresponds to FPDFAnnot_HasKey().

Source

pub fn annot_has_key(&self, key: &str) -> bool

ADR-019 alias for Self::has_key().

Corresponds to FPDFAnnot_HasKey().

Source

pub fn number_value(&self, key: &str) -> Option<f32>

Returns the numeric value for a well-known annotation key, or None.

Currently supports: "F" (flags as u32), "Border-Width" (border width in points).

Corresponds to FPDFAnnot_GetNumberValue().

Source

pub fn annot_get_number_value(&self, key: &str) -> Option<f32>

ADR-019 alias for Self::number_value().

Corresponds to FPDFAnnot_GetNumberValue().

Source

pub fn get_number_value(&self, key: &str) -> Option<f32>

👎Deprecated since 0.1.0:

use annot_get_number_value() instead

Deprecated: use annot_get_number_value() instead.

Source

pub fn value_type(&self, key: &str) -> PdfValueType

Returns the PDF object type of the value stored under key in the annotation’s logical field set.

Keys inspected: "Contents", "NM" (String), "F" (Number), "Subtype" (Name), "AP" (Dictionary), "Rect" (Array), "C" (Array), "Vertices" (Array), "QuadPoints" (Array), "InkList" (Array), "IRT" (Reference).

Returns PdfValueType::Unknown if the key is not recognised or the corresponding field is None.

Corresponds to FPDFAnnot_GetValueType().

Source

pub fn annot_get_value_type(&self, key: &str) -> PdfValueType

ADR-019 alias for Self::value_type().

Corresponds to FPDFAnnot_GetValueType().

Source

pub fn get_value_type(&self, key: &str) -> PdfValueType

👎Deprecated since 0.1.0:

use annot_get_value_type() instead

Deprecated: use annot_get_value_type() instead.

Source

pub fn appearance_stream_bytes(&self, mode: AppearanceMode) -> Option<&[u8]>

Returns the decoded content bytes of the annotation’s appearance stream for the given mode, or None if no appearance stream is available for that mode.

The bytes are the decoded (post-filter) PDF content stream data from the /AP /N (Normal), /AP /R (Rollover), or /AP /D (Down) sub-entry.

Corresponds to FPDFAnnot_GetAP().

Source

pub fn annot_get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>

ADR-019 alias for Self::appearance_stream_bytes().

Corresponds to FPDFAnnot_GetAP().

Source

pub fn get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>

👎Deprecated since 0.1.0:

use annot_get_ap() instead

Deprecated: use annot_get_ap() instead.

Source

pub fn get_appearance_stream_bytes(&self, mode: AppearanceMode) -> Option<&[u8]>

👎Deprecated since 0.1.0:

use annot_get_ap() instead

Deprecated: use annot_get_ap() instead.

Source

pub fn set_appearance_stream_bytes( &mut self, _mode: AppearanceMode, _data: &[u8], ) -> DocResult<()>

Set the appearance stream for the given mode.

§Not Supported

AP stream mutation is not yet supported (requires Form XObject creation). This stub is provided for API completeness per ADR-017.

Corresponds to FPDFAnnot_SetAP().

Source

pub fn annot_set_ap( &mut self, mode: AppearanceMode, data: &[u8], ) -> DocResult<()>

ADR-019 alias for Self::set_appearance_stream_bytes().

Corresponds to FPDFAnnot_SetAP().

Source

pub fn set_ap(&mut self, mode: AppearanceMode, data: &[u8]) -> DocResult<()>

👎Deprecated since 0.1.0:

use annot_set_ap() instead

Deprecated: use annot_set_ap() instead.

Source

pub fn linked_annot_ref(&self) -> Option<ObjectId>

Returns the ObjectId of the annotation referenced by /IRT (“In Reply To”), if any.

The /IRT entry is present on annotations that are replies to another annotation (e.g., a reply thread in a comment workflow). The returned ObjectId identifies the parent annotation object.

Corresponds to FPDFAnnot_GetLinkedAnnot().

Source

pub fn annot_get_linked_annot(&self) -> Option<ObjectId>

ADR-019 alias for Self::linked_annot_ref().

Corresponds to FPDFAnnot_GetLinkedAnnot().

Source

pub fn get_linked_annot(&self) -> Option<ObjectId>

👎Deprecated since 0.1.0:

use annot_get_linked_annot() instead

Deprecated: use annot_get_linked_annot() instead.

Source

pub fn form_field_flags(&self) -> Option<FormFieldFlags>

Returns the form field flags (/Ff) for widget annotations, or None if the annotation has no /Ff entry.

The flags encode properties such as read-only, required, multiline, password, etc. (ISO 32000-2 Table 226).

Unlike the upstream FPDFAnnot_GetFormFieldFlags(), this method does not require a FORMHANDLE parameter because rpdfium embeds the flags directly in the parsed Annotation struct.

Corresponds to FPDFAnnot_GetFormFieldFlags().

Source

pub fn annot_get_form_field_flags(&self) -> Option<FormFieldFlags>

ADR-019 alias for Self::form_field_flags().

Corresponds to FPDFAnnot_GetFormFieldFlags().

Source

pub fn get_form_field_flags(&self) -> Option<FormFieldFlags>

👎Deprecated since 0.1.0:

use annot_get_form_field_flags() instead

Deprecated: use annot_get_form_field_flags() instead.

Source

pub fn font_size(&self) -> Option<f32>

Returns the font size from the default appearance (/DA) string.

Parses the Tf operator in the /DA string. Returns None if no /DA is present or the font size is 0 (variable — determined by field size).

Valid for FreeText and Widget annotations.

Corresponds to FPDFAnnot_GetFontSize().

Source

pub fn annot_get_font_size(&self) -> Option<f32>

ADR-019 alias for Self::font_size().

Corresponds to FPDFAnnot_GetFontSize().

Source

pub fn font_color(&self) -> Option<(u8, u8, u8)>

Returns the font color from the default appearance (/DA) string as (R, G, B).

Parses the color operator (g, rg, or k) in the /DA string and converts to 8-bit RGB values (0–255). Returns None if no color is specified in the DA string.

Valid for FreeText and Widget annotations.

Corresponds to FPDFAnnot_GetFontColor().

Source

pub fn annot_get_font_color(&self) -> Option<(u8, u8, u8)>

ADR-019 alias for Self::font_color().

Corresponds to FPDFAnnot_GetFontColor().

Source

pub fn set_font_color(&mut self, r: u8, g: u8, b: u8) -> DocResult<()>

Sets the font color in the default appearance (/DA) string.

Updates the in-memory default appearance string by replacing or appending an rg color operator. To persist, use the edit layer to re-serialize the annotation.

Valid for FreeText and Widget annotations. Returns Err if the annotation subtype does not support a /DA string.

Corresponds to FPDFAnnot_SetFontColor().

Source

pub fn annot_set_font_color(&mut self, r: u8, g: u8, b: u8) -> DocResult<()>

ADR-019 alias for Self::set_font_color().

Corresponds to FPDFAnnot_SetFontColor().

Source

pub fn form_additional_action_javascript( &self, event_type: AActionType, ) -> String

Returns the JavaScript code for a form field additional action event.

Looks up the /AA entry for event_type on Widget annotations and returns the JavaScript code if the action is a JavaScript action. Returns an empty string if no such action exists or the action is not a JavaScript action (matching upstream FPDFAnnot_GetFormAdditionalActionJavaScript behavior).

Only meaningful for Widget annotations.

Corresponds to FPDFAnnot_GetFormAdditionalActionJavaScript().

Source

pub fn annot_get_form_additional_action_javascript( &self, event_type: AActionType, ) -> String

ADR-019 alias for Self::form_additional_action_javascript().

Corresponds to FPDFAnnot_GetFormAdditionalActionJavaScript().

Returns the action and destination stored on this annotation, intended for use with Link annotations.

Returns (action, destination) where each component may be None if not present in the annotation dictionary.

In the upstream PDFium API, FPDFAnnot_GetLink() returns an opaque FPDF_LINK handle wrapping the same data. rpdfium instead returns a tuple of references.

Corresponds to FPDFAnnot_GetLink().

ADR-019 alias for Self::link_ref().

Corresponds to FPDFAnnot_GetLink().

👎Deprecated since 0.1.0:

use annot_get_link() instead

Deprecated: use annot_get_link() instead.

Source

pub fn file_attachment(&self) -> Option<&FileSpec>

Returns the file specification attached to a FileAttachment annotation (the /FS entry), or None if not present.

Corresponds to FPDFAnnot_GetFileAttachment().

Source

pub fn annot_get_file_attachment(&self) -> Option<&FileSpec>

ADR-019 alias for Self::file_attachment().

Corresponds to FPDFAnnot_GetFileAttachment().

Source

pub fn get_file_attachment(&self) -> Option<&FileSpec>

👎Deprecated since 0.1.0:

use annot_get_file_attachment() instead

Deprecated: use annot_get_file_attachment() instead.

Source

pub fn form_field_type(&self) -> Option<FormFieldType>

Returns the form field type (/FT) for widget annotations.

Returns None for non-widget annotations or when /FT is only present on a parent field dictionary.

Corresponds to FPDFAnnot_GetFormFieldType().

Source

pub fn annot_get_form_field_type(&self) -> Option<FormFieldType>

ADR-019 alias for Self::form_field_type().

Corresponds to FPDFAnnot_GetFormFieldType().

Source

pub fn form_control_count(&self) -> DocResult<usize>

Returns the number of form controls for this annotation in the AcroForm.

§Not Supported

Requires document-level AcroForm traversal which is not supported in the annotation-level API (ADR-002: read-only, no form session).

Corresponds to FPDFAnnot_GetFormControlCount().

Source

pub fn annot_get_form_control_count(&self) -> DocResult<usize>

ADR-019 alias for Self::form_control_count().

Corresponds to FPDFAnnot_GetFormControlCount().

Source

pub fn form_control_index(&self) -> DocResult<usize>

Returns the index of this annotation in its form control list.

§Not Supported

Requires document-level AcroForm traversal which is not supported in the annotation-level API (ADR-002: read-only, no form session).

Corresponds to FPDFAnnot_GetFormControlIndex().

Source

pub fn annot_get_form_control_index(&self) -> DocResult<usize>

ADR-019 alias for Self::form_control_index().

Corresponds to FPDFAnnot_GetFormControlIndex().

Source

pub fn form_field_export_value(&self) -> DocResult<String>

Returns the export value for this form control.

§Not Supported

Requires document-level AcroForm traversal which is not supported in the annotation-level API (ADR-002: read-only, no form session).

Corresponds to FPDFAnnot_GetFormFieldExportValue().

Source

pub fn annot_get_form_field_export_value(&self) -> DocResult<String>

ADR-019 alias for Self::form_field_export_value().

Corresponds to FPDFAnnot_GetFormFieldExportValue().

Source

pub fn is_checked(&self) -> bool

Returns true if this checkbox or radio-button annotation is checked.

A check-box is considered checked when its /V value is anything other than "Off" or absent.

Corresponds to FPDFAnnot_IsChecked().

Source

pub fn annot_is_checked(&self) -> bool

ADR-019 alias for Self::is_checked().

Corresponds to FPDFAnnot_IsChecked().

Source

pub fn option_count(&self) -> usize

Returns the number of options in a choice-field annotation.

Returns 0 if the annotation has no /Opt array (non-choice fields).

Corresponds to FPDFAnnot_GetOptionCount().

Source

pub fn annot_get_option_count(&self) -> usize

ADR-019 alias for Self::option_count().

Corresponds to FPDFAnnot_GetOptionCount().

Source

pub fn option_label(&self, index: usize) -> Option<&str>

Returns the display label for the option at index, or None if the index is out of bounds.

Corresponds to FPDFAnnot_GetOptionLabel().

Source

pub fn annot_get_option_label(&self, index: usize) -> Option<&str>

ADR-019 alias for Self::option_label().

Corresponds to FPDFAnnot_GetOptionLabel().

Source

pub fn is_option_selected(&self, index: usize) -> bool

Returns true if the option at index is currently selected.

For choice fields the selected option is identified by comparing the option’s export_value against the annotation’s /V string.

Corresponds to FPDFAnnot_IsOptionSelected().

Source

pub fn annot_is_option_selected(&self, index: usize) -> bool

ADR-019 alias for Self::is_option_selected().

Corresponds to FPDFAnnot_IsOptionSelected().

Source

pub fn focusable_subtype_count(&self) -> DocResult<usize>

Returns the count of focusable annotation subtypes configured on the viewer.

§Not Supported

Focusable subtype configuration is a viewer/form-session concept that requires a FPDF_FORMHANDLE and is not supported in rpdfium’s document-level read-only API (ADR-002).

Corresponds to FPDFAnnot_GetFocusableSubtypesCount().

Source

pub fn annot_get_focusable_subtypes_count(&self) -> DocResult<usize>

ADR-019 alias for Self::focusable_subtype_count().

Corresponds to FPDFAnnot_GetFocusableSubtypesCount().

Source

pub fn set_focusable_subtypes( &mut self, _subtypes: &[AnnotationType], ) -> DocResult<()>

Sets the focusable annotation subtypes on the viewer.

§Not Supported

Focusable subtype configuration is a viewer/form-session concept that requires a FPDF_FORMHANDLE and is not supported in rpdfium’s document-level read-only API (ADR-002).

Corresponds to FPDFAnnot_SetFocusableSubtypes().

Source

pub fn annot_set_focusable_subtypes( &mut self, subtypes: &[AnnotationType], ) -> DocResult<()>

ADR-019 alias for Self::set_focusable_subtypes().

Corresponds to FPDFAnnot_SetFocusableSubtypes().

Source

pub fn set_flags(&mut self, flags: AnnotationFlags) -> DocResult<()>

Sets the annotation flags (/F).

Updates the in-memory flags. To persist, re-serialize the annotation via the edit layer.

Corresponds to FPDFAnnot_SetFlags().

Source

pub fn annot_set_flags(&mut self, flags: AnnotationFlags) -> DocResult<()>

ADR-019 alias for Self::set_flags().

Corresponds to FPDFAnnot_SetFlags().

Source

pub fn set_form_field_flags(&mut self, flags: FormFieldFlags) -> DocResult<()>

Sets the form field flags (/Ff) for widget annotations.

Updates the in-memory flags. To persist, re-serialize the annotation via the edit layer.

Corresponds to FPDFAnnot_SetFormFieldFlags() (planned upstream API).

Source

pub fn annot_set_form_field_flags( &mut self, flags: FormFieldFlags, ) -> DocResult<()>

ADR-019 alias for Self::set_form_field_flags().

Corresponds to FPDFAnnot_SetFormFieldFlags().

Trait Implementations§

Source§

impl Clone for Annotation

Source§

fn clone(&self) -> Annotation

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 Annotation

Source§

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

Formats the value using the given formatter. Read more

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more