Skip to main content

add_annotation_to_page

Function add_annotation_to_page 

Source
pub fn add_annotation_to_page(
    doc: &mut Document,
    page_num: u32,
    annot_id: ObjectId,
) -> Result<(), AnnotBuildError>
Expand description

Add an annotation reference to a page’s /Annots array.

Handles both inline arrays and indirect (referenced) arrays. When the indirect Annots array cannot be resolved (e.g. it lives in a compressed ObjStm that lopdf failed to expand), falls back to replacing the /Annots entry with a new inline array so the annotation is never silently dropped.