Skip to main content

remove_attachment

Function remove_attachment 

Source
pub fn remove_attachment(
    edit: &mut EditDoc<'_>,
    limits: &Limits,
    name: &str,
) -> Result<bool, Error>
Expand description

Removes every attachment named name from the name tree; Ok(false) when there is none. The objects go with the next full save’s garbage collection.

use pdfrum::Document;

let doc = Document::open("tests/fixtures/embedded_attachments.pdf")?;
let mut edit = doc.edit();
assert!(edit.remove_attachment("1.txt")?);
assert!(!edit.remove_attachment("1.txt")?, "already gone");

§Errors

When the document has no catalog to hold the tree.