Ship native PDF annotations with reserved object numbers

This commit is contained in:
gloamxun committed 2026-11-28 15:39:27 +08:00
1 parent 975dbc8060
commit de4bd1fa76
14 files changed
+299 -67

No files matched your search

@@ -680,13 +680,28 @@ impl Printer<'_> {
use crate::pdf_device::links::LinkNode;
self.command(match node {
LinkNode::Start(_) => "pdfstartlink",
LinkNode::Annotation { .. } => "pdfannot",
LinkNode::End => "pdfendlink",
LinkNode::Running(false) => "pdfrunninglinkoff",
LinkNode::Running(true) => "pdfrunninglinkon",
LinkNode::Destination { .. } => "pdfdest",
});
if let LinkNode::Destination { structure: Some(object), .. } = node {
self.literal(&format!(" struct{object}"));
match node {
LinkNode::Annotation { dimensions: [width, height, depth], entries, .. } => {
for (separator, dimension) in [("(", height), ("+", depth), (")x", width)] {
self.literal(separator);
if let Some(value) = dimension {
self.number(i64::from(*value));
} else {
self.literal("*");
}
}
self.tokens(entries)?;
}
LinkNode::Destination { structure: Some(object), .. } => {
self.literal(&format!(" struct{object}"));
}
_ => {}
}
}
OutputOperation::PdfLiteral { mode, shipout, tokens } => {