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: AnnotationTypeThe 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: AnnotationFlagsAnnotation 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: AnnotationSubtypeDataSubtype-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
impl Annotation
Sourcepub fn set_rect(&mut self, rect: [f32; 4]) -> DocResult<()>
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.
Sourcepub fn annot_set_rect(&mut self, rect: [f32; 4]) -> DocResult<()>
pub fn annot_set_rect(&mut self, rect: [f32; 4]) -> DocResult<()>
ADR-019 alias for Self::set_rect().
Corresponds to FPDFAnnot_SetRect().
Sourcepub fn set_open_state(&mut self, open: bool) -> DocResult<()>
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.
Sourcepub fn quad_points(&self) -> Option<&[f32]>
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().
Sourcepub fn annot_get_quad_points(&self) -> Option<&[f32]>
pub fn annot_get_quad_points(&self) -> Option<&[f32]>
ADR-019 alias for quad_points().
Corresponds to upstream CPDF_Annot::GetQuadPoints().
Sourcepub fn get_quad_points(&self) -> Option<&[f32]>
👎Deprecated since 0.1.0: use annot_get_quad_points() instead
pub fn get_quad_points(&self) -> Option<&[f32]>
use annot_get_quad_points() instead
Deprecated: use annot_get_quad_points() instead.
Sourcepub fn subtype(&self) -> AnnotationType
pub fn subtype(&self) -> AnnotationType
Returns the annotation subtype.
Corresponds to FPDFAnnot_GetSubtype().
Sourcepub fn annot_get_subtype(&self) -> AnnotationType
pub fn annot_get_subtype(&self) -> AnnotationType
ADR-019 alias for Self::subtype().
Corresponds to FPDFAnnot_GetSubtype().
Sourcepub fn get_subtype(&self) -> AnnotationType
👎Deprecated since 0.1.0: use annot_get_subtype() instead
pub fn get_subtype(&self) -> AnnotationType
use annot_get_subtype() instead
Deprecated: use annot_get_subtype() instead.
Sourcepub fn rect(&self) -> [f32; 4]
pub fn rect(&self) -> [f32; 4]
Returns the annotation rectangle [x1, y1, x2, y2].
Corresponds to FPDFAnnot_GetRect().
Sourcepub fn annot_get_rect(&self) -> [f32; 4]
pub fn annot_get_rect(&self) -> [f32; 4]
ADR-019 alias for Self::rect().
Corresponds to FPDFAnnot_GetRect().
Sourcepub fn get_rect(&self) -> [f32; 4]
👎Deprecated since 0.1.0: use annot_get_rect() instead
pub fn get_rect(&self) -> [f32; 4]
use annot_get_rect() instead
Deprecated: use annot_get_rect() instead.
Sourcepub fn flags(&self) -> AnnotationFlags
pub fn flags(&self) -> AnnotationFlags
Returns the annotation flags.
Corresponds to FPDFAnnot_GetFlags().
Sourcepub fn annot_get_flags(&self) -> AnnotationFlags
pub fn annot_get_flags(&self) -> AnnotationFlags
ADR-019 alias for Self::flags().
Corresponds to FPDFAnnot_GetFlags().
Sourcepub fn get_flags(&self) -> AnnotationFlags
👎Deprecated since 0.1.0: use annot_get_flags() instead
pub fn get_flags(&self) -> AnnotationFlags
use annot_get_flags() instead
Deprecated: use annot_get_flags() instead.
Sourcepub fn has_attachment_points(&self) -> bool
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().
Sourcepub fn annot_has_attachment_points(&self) -> bool
pub fn annot_has_attachment_points(&self) -> bool
ADR-019 alias for Self::has_attachment_points().
Corresponds to FPDFAnnot_HasAttachmentPoints().
Sourcepub fn attachment_point_count(&self) -> usize
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().
Sourcepub fn annot_count_attachment_points(&self) -> usize
pub fn annot_count_attachment_points(&self) -> usize
ADR-019 alias for Self::attachment_point_count().
Corresponds to FPDFAnnot_CountAttachmentPoints().
Sourcepub fn count_attachment_points(&self) -> usize
👎Deprecated since 0.1.0: use annot_count_attachment_points() instead
pub fn count_attachment_points(&self) -> usize
use annot_count_attachment_points() instead
Deprecated: use annot_count_attachment_points() instead.
Sourcepub fn attachment_points(&self, index: usize) -> Option<[f32; 8]>
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().
Sourcepub fn annot_get_attachment_points(&self, index: usize) -> Option<[f32; 8]>
pub fn annot_get_attachment_points(&self, index: usize) -> Option<[f32; 8]>
ADR-019 alias for Self::attachment_points().
Corresponds to FPDFAnnot_GetAttachmentPoints().
Sourcepub fn get_attachment_points(&self, index: usize) -> Option<[f32; 8]>
👎Deprecated since 0.1.0: use annot_get_attachment_points() instead
pub fn get_attachment_points(&self, index: usize) -> Option<[f32; 8]>
use annot_get_attachment_points() instead
Deprecated: use annot_get_attachment_points() instead.
Sourcepub fn vertices(&self) -> Option<&[f32]>
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().
Sourcepub fn annot_get_vertices(&self) -> Option<&[f32]>
pub fn annot_get_vertices(&self) -> Option<&[f32]>
ADR-019 alias for Self::vertices().
Corresponds to FPDFAnnot_GetVertices().
Sourcepub fn get_vertices(&self) -> Option<&[f32]>
👎Deprecated since 0.1.0: use annot_get_vertices() instead
pub fn get_vertices(&self) -> Option<&[f32]>
use annot_get_vertices() instead
Deprecated: use annot_get_vertices() instead.
Sourcepub fn ink_list_count(&self) -> usize
pub fn ink_list_count(&self) -> usize
Returns the number of ink strokes for Ink annotations.
Corresponds to FPDFAnnot_GetInkListCount().
Sourcepub fn annot_get_ink_list_count(&self) -> usize
pub fn annot_get_ink_list_count(&self) -> usize
ADR-019 alias for Self::ink_list_count().
Corresponds to FPDFAnnot_GetInkListCount().
Sourcepub fn get_ink_list_count(&self) -> usize
👎Deprecated since 0.1.0: use annot_get_ink_list_count() instead
pub fn get_ink_list_count(&self) -> usize
use annot_get_ink_list_count() instead
Deprecated: use annot_get_ink_list_count() instead.
Sourcepub fn ink_list_path(&self, index: usize) -> Option<&[f32]>
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().
Sourcepub fn annot_get_ink_list_path(&self, index: usize) -> Option<&[f32]>
pub fn annot_get_ink_list_path(&self, index: usize) -> Option<&[f32]>
ADR-019 alias for Self::ink_list_path().
Corresponds to FPDFAnnot_GetInkListPath().
Sourcepub fn get_ink_list_path(&self, index: usize) -> Option<&[f32]>
👎Deprecated since 0.1.0: use annot_get_ink_list_path() instead
pub fn get_ink_list_path(&self, index: usize) -> Option<&[f32]>
use annot_get_ink_list_path() instead
Deprecated: use annot_get_ink_list_path() instead.
Sourcepub fn line_endpoints(&self) -> Option<([f32; 2], [f32; 2])>
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().
Sourcepub fn annot_get_line(&self) -> Option<([f32; 2], [f32; 2])>
pub fn annot_get_line(&self) -> Option<([f32; 2], [f32; 2])>
ADR-019 alias for Self::line_endpoints().
Corresponds to FPDFAnnot_GetLine().
Sourcepub fn get_line(&self) -> Option<([f32; 2], [f32; 2])>
👎Deprecated since 0.1.0: use annot_get_line() instead
pub fn get_line(&self) -> Option<([f32; 2], [f32; 2])>
use annot_get_line() instead
Deprecated: use annot_get_line() instead.
Sourcepub fn get_line_endpoints(&self) -> Option<([f32; 2], [f32; 2])>
👎Deprecated since 0.1.0: use annot_get_line() instead
pub fn get_line_endpoints(&self) -> Option<([f32; 2], [f32; 2])>
use annot_get_line() instead
Deprecated: use annot_get_line() instead.
Sourcepub fn border_style(&self) -> Option<(f32, f32, f32)>
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().
Sourcepub fn annot_get_border(&self) -> Option<(f32, f32, f32)>
pub fn annot_get_border(&self) -> Option<(f32, f32, f32)>
ADR-019 alias for Self::border_style().
Corresponds to FPDFAnnot_GetBorder().
Sourcepub fn get_border(&self) -> Option<(f32, f32, f32)>
👎Deprecated since 0.1.0: use annot_get_border() instead
pub fn get_border(&self) -> Option<(f32, f32, f32)>
use annot_get_border() instead
Deprecated: use annot_get_border() instead.
Sourcepub fn get_border_style(&self) -> Option<(f32, f32, f32)>
👎Deprecated since 0.1.0: use annot_get_border() instead
pub fn get_border_style(&self) -> Option<(f32, f32, f32)>
use annot_get_border() instead
Deprecated: use annot_get_border() instead.
Sourcepub fn color_rgba(&self) -> Option<(u8, u8, u8, u8)>
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().
Sourcepub fn annot_get_color(&self) -> Option<(u8, u8, u8, u8)>
pub fn annot_get_color(&self) -> Option<(u8, u8, u8, u8)>
ADR-019 alias for Self::color_rgba().
Corresponds to FPDFAnnot_GetColor().
Sourcepub fn get_color(&self) -> Option<(u8, u8, u8, u8)>
👎Deprecated since 0.1.0: use annot_get_color() instead
pub fn get_color(&self) -> Option<(u8, u8, u8, u8)>
use annot_get_color() instead
Deprecated: use annot_get_color() instead.
Sourcepub fn get_color_rgba(&self) -> Option<(u8, u8, u8, u8)>
👎Deprecated since 0.1.0: use annot_get_color() instead
pub fn get_color_rgba(&self) -> Option<(u8, u8, u8, u8)>
use annot_get_color() instead
Deprecated: use annot_get_color() instead.
Sourcepub fn string_value(&self, key: &str) -> Option<&str>
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().
Sourcepub fn annot_get_string_value(&self, key: &str) -> Option<&str>
pub fn annot_get_string_value(&self, key: &str) -> Option<&str>
ADR-019 alias for Self::string_value().
Corresponds to FPDFAnnot_GetStringValue().
Sourcepub fn get_string_value(&self, key: &str) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_string_value() instead
pub fn get_string_value(&self, key: &str) -> Option<&str>
use annot_get_string_value() instead
Deprecated: use annot_get_string_value() instead.
Sourcepub fn field_name(&self) -> Option<&str>
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().
Sourcepub fn annot_get_form_field_name(&self) -> Option<&str>
pub fn annot_get_form_field_name(&self) -> Option<&str>
ADR-019 alias for Self::field_name().
Corresponds to FPDFAnnot_GetFormFieldName().
Sourcepub fn get_form_field_name(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_name() instead
pub fn get_form_field_name(&self) -> Option<&str>
use annot_get_form_field_name() instead
Deprecated: use annot_get_form_field_name() instead.
Sourcepub fn get_field_name(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_name() instead
pub fn get_field_name(&self) -> Option<&str>
use annot_get_form_field_name() instead
Deprecated: use annot_get_form_field_name() instead.
Sourcepub fn alternate_field_name(&self) -> Option<&str>
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().
Sourcepub fn annot_get_form_field_alternate_name(&self) -> Option<&str>
pub fn annot_get_form_field_alternate_name(&self) -> Option<&str>
ADR-019 alias for Self::alternate_field_name().
Corresponds to FPDFAnnot_GetFormFieldAlternateName().
Sourcepub fn get_form_field_alternate_name(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_alternate_name() instead
pub fn get_form_field_alternate_name(&self) -> Option<&str>
use annot_get_form_field_alternate_name() instead
Deprecated: use annot_get_form_field_alternate_name() instead.
Sourcepub fn get_alternate_field_name(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_alternate_name() instead
pub fn get_alternate_field_name(&self) -> Option<&str>
use annot_get_form_field_alternate_name() instead
Deprecated: use annot_get_form_field_alternate_name() instead.
Sourcepub fn field_value_str(&self) -> Option<&str>
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().
Sourcepub fn annot_get_form_field_value(&self) -> Option<&str>
pub fn annot_get_form_field_value(&self) -> Option<&str>
ADR-019 alias for Self::field_value_str().
Corresponds to FPDFAnnot_GetFormFieldValue().
Sourcepub fn get_form_field_value(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_value() instead
pub fn get_form_field_value(&self) -> Option<&str>
use annot_get_form_field_value() instead
Deprecated: use annot_get_form_field_value() instead.
Sourcepub fn get_field_value(&self) -> Option<&str>
👎Deprecated since 0.1.0: use annot_get_form_field_value() instead
pub fn get_field_value(&self) -> Option<&str>
use annot_get_form_field_value() instead
Deprecated: use annot_get_form_field_value() instead.
Sourcepub fn has_key(&self, key: &str) -> bool
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().
Sourcepub fn annot_has_key(&self, key: &str) -> bool
pub fn annot_has_key(&self, key: &str) -> bool
ADR-019 alias for Self::has_key().
Corresponds to FPDFAnnot_HasKey().
Sourcepub fn number_value(&self, key: &str) -> Option<f32>
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().
Sourcepub fn annot_get_number_value(&self, key: &str) -> Option<f32>
pub fn annot_get_number_value(&self, key: &str) -> Option<f32>
ADR-019 alias for Self::number_value().
Corresponds to FPDFAnnot_GetNumberValue().
Sourcepub fn get_number_value(&self, key: &str) -> Option<f32>
👎Deprecated since 0.1.0: use annot_get_number_value() instead
pub fn get_number_value(&self, key: &str) -> Option<f32>
use annot_get_number_value() instead
Deprecated: use annot_get_number_value() instead.
Sourcepub fn value_type(&self, key: &str) -> PdfValueType
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().
Sourcepub fn annot_get_value_type(&self, key: &str) -> PdfValueType
pub fn annot_get_value_type(&self, key: &str) -> PdfValueType
ADR-019 alias for Self::value_type().
Corresponds to FPDFAnnot_GetValueType().
Sourcepub fn get_value_type(&self, key: &str) -> PdfValueType
👎Deprecated since 0.1.0: use annot_get_value_type() instead
pub fn get_value_type(&self, key: &str) -> PdfValueType
use annot_get_value_type() instead
Deprecated: use annot_get_value_type() instead.
Sourcepub fn appearance_stream_bytes(&self, mode: AppearanceMode) -> Option<&[u8]>
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().
Sourcepub fn annot_get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>
pub fn annot_get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>
ADR-019 alias for Self::appearance_stream_bytes().
Corresponds to FPDFAnnot_GetAP().
Sourcepub fn get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>
👎Deprecated since 0.1.0: use annot_get_ap() instead
pub fn get_ap(&self, mode: AppearanceMode) -> Option<&[u8]>
use annot_get_ap() instead
Deprecated: use annot_get_ap() instead.
Sourcepub fn get_appearance_stream_bytes(&self, mode: AppearanceMode) -> Option<&[u8]>
👎Deprecated since 0.1.0: use annot_get_ap() instead
pub fn get_appearance_stream_bytes(&self, mode: AppearanceMode) -> Option<&[u8]>
use annot_get_ap() instead
Deprecated: use annot_get_ap() instead.
Sourcepub fn set_appearance_stream_bytes(
&mut self,
_mode: AppearanceMode,
_data: &[u8],
) -> DocResult<()>
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().
Sourcepub fn annot_set_ap(
&mut self,
mode: AppearanceMode,
data: &[u8],
) -> DocResult<()>
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().
Sourcepub fn set_ap(&mut self, mode: AppearanceMode, data: &[u8]) -> DocResult<()>
👎Deprecated since 0.1.0: use annot_set_ap() instead
pub fn set_ap(&mut self, mode: AppearanceMode, data: &[u8]) -> DocResult<()>
use annot_set_ap() instead
Deprecated: use annot_set_ap() instead.
Sourcepub fn linked_annot_ref(&self) -> Option<ObjectId>
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().
Sourcepub fn annot_get_linked_annot(&self) -> Option<ObjectId>
pub fn annot_get_linked_annot(&self) -> Option<ObjectId>
ADR-019 alias for Self::linked_annot_ref().
Corresponds to FPDFAnnot_GetLinkedAnnot().
Sourcepub fn get_linked_annot(&self) -> Option<ObjectId>
👎Deprecated since 0.1.0: use annot_get_linked_annot() instead
pub fn get_linked_annot(&self) -> Option<ObjectId>
use annot_get_linked_annot() instead
Deprecated: use annot_get_linked_annot() instead.
Sourcepub fn form_field_flags(&self) -> Option<FormFieldFlags>
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().
Sourcepub fn annot_get_form_field_flags(&self) -> Option<FormFieldFlags>
pub fn annot_get_form_field_flags(&self) -> Option<FormFieldFlags>
ADR-019 alias for Self::form_field_flags().
Corresponds to FPDFAnnot_GetFormFieldFlags().
Sourcepub fn get_form_field_flags(&self) -> Option<FormFieldFlags>
👎Deprecated since 0.1.0: use annot_get_form_field_flags() instead
pub fn get_form_field_flags(&self) -> Option<FormFieldFlags>
use annot_get_form_field_flags() instead
Deprecated: use annot_get_form_field_flags() instead.
Sourcepub fn font_size(&self) -> Option<f32>
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().
Sourcepub fn annot_get_font_size(&self) -> Option<f32>
pub fn annot_get_font_size(&self) -> Option<f32>
ADR-019 alias for Self::font_size().
Corresponds to FPDFAnnot_GetFontSize().
Sourcepub fn font_color(&self) -> Option<(u8, u8, u8)>
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().
Sourcepub fn annot_get_font_color(&self) -> Option<(u8, u8, u8)>
pub fn annot_get_font_color(&self) -> Option<(u8, u8, u8)>
ADR-019 alias for Self::font_color().
Corresponds to FPDFAnnot_GetFontColor().
Sourcepub fn set_font_color(&mut self, r: u8, g: u8, b: u8) -> DocResult<()>
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().
Sourcepub fn annot_set_font_color(&mut self, r: u8, g: u8, b: u8) -> DocResult<()>
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().
Sourcepub fn form_additional_action_javascript(
&self,
event_type: AActionType,
) -> String
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().
Sourcepub fn annot_get_form_additional_action_javascript(
&self,
event_type: AActionType,
) -> String
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().
Sourcepub fn link_ref(&self) -> (Option<&Action>, Option<&Destination>)
pub fn link_ref(&self) -> (Option<&Action>, Option<&Destination>)
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().
Sourcepub fn annot_get_link(&self) -> (Option<&Action>, Option<&Destination>)
pub fn annot_get_link(&self) -> (Option<&Action>, Option<&Destination>)
ADR-019 alias for Self::link_ref().
Corresponds to FPDFAnnot_GetLink().
Sourcepub fn get_link(&self) -> (Option<&Action>, Option<&Destination>)
👎Deprecated since 0.1.0: use annot_get_link() instead
pub fn get_link(&self) -> (Option<&Action>, Option<&Destination>)
use annot_get_link() instead
Deprecated: use annot_get_link() instead.
Sourcepub fn file_attachment(&self) -> Option<&FileSpec>
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().
Sourcepub fn annot_get_file_attachment(&self) -> Option<&FileSpec>
pub fn annot_get_file_attachment(&self) -> Option<&FileSpec>
ADR-019 alias for Self::file_attachment().
Corresponds to FPDFAnnot_GetFileAttachment().
Sourcepub fn get_file_attachment(&self) -> Option<&FileSpec>
👎Deprecated since 0.1.0: use annot_get_file_attachment() instead
pub fn get_file_attachment(&self) -> Option<&FileSpec>
use annot_get_file_attachment() instead
Deprecated: use annot_get_file_attachment() instead.
Sourcepub fn form_field_type(&self) -> Option<FormFieldType>
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().
Sourcepub fn annot_get_form_field_type(&self) -> Option<FormFieldType>
pub fn annot_get_form_field_type(&self) -> Option<FormFieldType>
ADR-019 alias for Self::form_field_type().
Corresponds to FPDFAnnot_GetFormFieldType().
Sourcepub fn form_control_count(&self) -> DocResult<usize>
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().
Sourcepub fn annot_get_form_control_count(&self) -> DocResult<usize>
pub fn annot_get_form_control_count(&self) -> DocResult<usize>
ADR-019 alias for Self::form_control_count().
Corresponds to FPDFAnnot_GetFormControlCount().
Sourcepub fn form_control_index(&self) -> DocResult<usize>
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().
Sourcepub fn annot_get_form_control_index(&self) -> DocResult<usize>
pub fn annot_get_form_control_index(&self) -> DocResult<usize>
ADR-019 alias for Self::form_control_index().
Corresponds to FPDFAnnot_GetFormControlIndex().
Sourcepub fn form_field_export_value(&self) -> DocResult<String>
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().
Sourcepub fn annot_get_form_field_export_value(&self) -> DocResult<String>
pub fn annot_get_form_field_export_value(&self) -> DocResult<String>
ADR-019 alias for Self::form_field_export_value().
Corresponds to FPDFAnnot_GetFormFieldExportValue().
Sourcepub fn is_checked(&self) -> bool
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().
Sourcepub fn annot_is_checked(&self) -> bool
pub fn annot_is_checked(&self) -> bool
ADR-019 alias for Self::is_checked().
Corresponds to FPDFAnnot_IsChecked().
Sourcepub fn option_count(&self) -> usize
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().
Sourcepub fn annot_get_option_count(&self) -> usize
pub fn annot_get_option_count(&self) -> usize
ADR-019 alias for Self::option_count().
Corresponds to FPDFAnnot_GetOptionCount().
Sourcepub fn option_label(&self, index: usize) -> Option<&str>
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().
Sourcepub fn annot_get_option_label(&self, index: usize) -> Option<&str>
pub fn annot_get_option_label(&self, index: usize) -> Option<&str>
ADR-019 alias for Self::option_label().
Corresponds to FPDFAnnot_GetOptionLabel().
Sourcepub fn is_option_selected(&self, index: usize) -> bool
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().
Sourcepub fn annot_is_option_selected(&self, index: usize) -> bool
pub fn annot_is_option_selected(&self, index: usize) -> bool
ADR-019 alias for Self::is_option_selected().
Corresponds to FPDFAnnot_IsOptionSelected().
Sourcepub fn focusable_subtype_count(&self) -> DocResult<usize>
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().
Sourcepub fn annot_get_focusable_subtypes_count(&self) -> DocResult<usize>
pub fn annot_get_focusable_subtypes_count(&self) -> DocResult<usize>
ADR-019 alias for Self::focusable_subtype_count().
Corresponds to FPDFAnnot_GetFocusableSubtypesCount().
Sourcepub fn set_focusable_subtypes(
&mut self,
_subtypes: &[AnnotationType],
) -> DocResult<()>
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().
Sourcepub fn annot_set_focusable_subtypes(
&mut self,
subtypes: &[AnnotationType],
) -> DocResult<()>
pub fn annot_set_focusable_subtypes( &mut self, subtypes: &[AnnotationType], ) -> DocResult<()>
ADR-019 alias for Self::set_focusable_subtypes().
Corresponds to FPDFAnnot_SetFocusableSubtypes().
Sourcepub fn set_flags(&mut self, flags: AnnotationFlags) -> DocResult<()>
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().
Sourcepub fn annot_set_flags(&mut self, flags: AnnotationFlags) -> DocResult<()>
pub fn annot_set_flags(&mut self, flags: AnnotationFlags) -> DocResult<()>
ADR-019 alias for Self::set_flags().
Corresponds to FPDFAnnot_SetFlags().
Sourcepub fn set_form_field_flags(&mut self, flags: FormFieldFlags) -> DocResult<()>
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).
Sourcepub fn annot_set_form_field_flags(
&mut self,
flags: FormFieldFlags,
) -> DocResult<()>
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
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more