From 0e52bf0df175cdfcf725bc6245b74e43406a9d68 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 9 Jul 2026 22:45:51 +0300 Subject: [PATCH] pdf-annotation-types: skip non-dictionary annotations Ignore annotation entries that cannot be resolved as dictionaries so a bad annotation does not prevent parsing the rest of the page. Co-authored-by: Codex --- crates/pdf-annotation-types/src/annotation.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/pdf-annotation-types/src/annotation.rs b/crates/pdf-annotation-types/src/annotation.rs index d97ea384..92cc084a 100644 --- a/crates/pdf-annotation-types/src/annotation.rs +++ b/crates/pdf-annotation-types/src/annotation.rs @@ -55,7 +55,9 @@ impl Annotation { let mut annotations = Vec::with_capacity(annots.len()); for annot in annots { - let dictionary = annot.try_dictionary(objects)?; + let Ok(dictionary) = annot.try_dictionary(objects) else { + continue; + }; // A broken annotation can still be useful to preserve the rest of the page, // but without `/Subtype` we cannot dispatch it to a concrete parser. if dictionary.get("Subtype").is_none() {