Skip to main content

delete_annotation

Function delete_annotation 

Source
pub fn delete_annotation(
    edit: &mut EditDoc<'_>,
    page: impl Into<PageIndex>,
    annot: ObjRef,
) -> Result<bool, Error>
Expand description

Removes annot from page’s /Annots and drops the annotation object.

Returns Ok(true) when it was listed and removed, Ok(false) when it was not on that page.

use pdfrum_edit::{AnnotSpec, SquareSpec, add_annotation, delete_annotation};
use pdfrum_edit::EditDoc;
use kurbo::Rect;
use peniko::Color;
let r = add_annotation(
    &mut edit,
    0,
    SquareSpec::new(Rect::new(0.0, 0.0, 10.0, 10.0), Color::from_rgb8(0, 0, 255)),
)?;
assert!(delete_annotation(&mut edit, 0, r)?);
assert!(!delete_annotation(&mut edit, 0, r)?);

§Errors

Error::PageIndexOutOfRange or Error::InlinePage for a bad page.