Scope XDV PDF content at the driver page origin

This commit is contained in:
gloamxun committed 2026-11-28 07:25:57 +08:00
1 parent ab6b1093ec
commit 526ec9b3b0
9 files changed
+176 -46

No files matched your search

@@ -690,7 +690,8 @@ impl Printer<'_> {
PdfLiteralMode::Origin => {}
PdfLiteralMode::Page => self.literal(" page"),
PdfLiteralMode::Direct => self.literal(" direct"),
PdfLiteralMode::XdvOrigin | PdfLiteralMode::XdvDirect => {}
PdfLiteralMode::XdvOrigin | PdfLiteralMode::XdvDirect
| PdfLiteralMode::XdvContent => {}
}
self.tokens(tokens)?;
}
@@ -155,7 +155,14 @@ impl Executor {
{
return Ok(Some(graphics));
}
let body = data.strip_prefix(b"pdf:").map(<[u8]>::trim_ascii_start);
let body = data.strip_prefix(b"pdf:").map(xdv_skip_white);
if let Some(content) = body.and_then(|body| xdv_operand(body, b"content")) {
let bytes = xdv_skip_white(content);
return Ok((!bytes.is_empty()).then(|| PdfGraphics::Literal {
mode: PdfLiteralMode::XdvContent,
bytes: Arc::from(bytes),
}));
}
if let Some(dictionary) = body.and_then(|body| xdv_operand(body, b"docinfo")) {
use crate::pdf_device::xdv_document::merge_docinfo;
let (entries, warnings) = merge_docinfo(&self.state.pdf_info, dictionary)