mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-17 16:16:34 +00:00
M5: a group is one page's, as Acrobat reads it
A subordinate (/RT /Group) whose /IRT primary is on another page is now a comment of its own, listed with its own author and text, rather than part of that group. ISO 32000-2 §12.5.6.2 doesn't limit a group to a page, but Acrobat (desktop and iPad) and PDF-XChange all keep such a subordinate when the primary is deleted, and Acrobat desktop lists it on its own; tested on a synthetic two-page file. pdfcraft_render::link_replies and pdfcraft_annot::summaries both apply the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
This commit is contained in:
1 parent
87a1778c82
commit
665b361d5c
3 files changed
+59
-1
No files matched your search
@@ -165,6 +165,12 @@ pub fn summaries(doc: &Document) -> Vec<Summary> {
|
||||
let irt = d.get(b"IRT").map(|o| o.as_ref().map_or_else(|| doc.resolve(o), |r| doc.get(final_ref(doc, r))));
|
||||
let in_reply_to = irt.and_then(|o| o.as_dict().cloned()).and_then(|p| text_value(doc, &p, b"NM"));
|
||||
let parent = d.get(b"IRT").and_then(Object::as_ref).and_then(|r| slots.get(&final_ref(doc, r)).copied());
|
||||
// A group is one page's, as Acrobat reads it: a subordinate whose primary is on
|
||||
// another page is a comment of its own (keep in step with
|
||||
// `pdfcraft_render::link_replies`).
|
||||
let grouped = d.name(b"RT") == Some(b"Group");
|
||||
let cross_page = grouped && parent.is_some_and(|(p, _)| p != page);
|
||||
let (parent, in_reply_to) = if cross_page { (None, None) } else { (parent, in_reply_to) };
|
||||
out.push(Summary {
|
||||
page,
|
||||
index,
|
||||
@@ -177,7 +183,7 @@ pub fn summaries(doc: &Document) -> Vec<Summary> {
|
||||
name: text_value(doc, d, b"NM"),
|
||||
in_reply_to,
|
||||
parent,
|
||||
grouped: d.name(b"RT") == Some(b"Group"),
|
||||
grouped,
|
||||
rect,
|
||||
color,
|
||||
state: text_value(doc, d, b"State"),
|
||||
|
||||
Reference in new issue
Block a user