Capture and reuse XeLaTeX PDF form contents

This commit is contained in:
gloamxun committed 2026-11-28 19:29:07 +08:00
1 parent 009fde04f7
commit c0e2346b05
16 files changed
+706 -53

No files matched your search

+7 -5
View File
@@ -344,6 +344,8 @@ impl SourceMap {
}
match operation {
PdfGraphics::Literal { .. } | PdfGraphics::TextBoundary => {}
PdfGraphics::XdvFormBegin(_) | PdfGraphics::XdvFormEnd(_) |
PdfGraphics::XdvFormUse { .. } => unreachable!("projected XDV form"),
PdfGraphics::Save => graphics_stack.push(transform),
PdfGraphics::Matrix(matrix) | PdfGraphics::SaveMatrix(matrix) => {
if matches!(operation, PdfGraphics::SaveMatrix(_)) {
@@ -471,11 +473,11 @@ impl SourceMap {
)),
DisplayItem::PdfForm { x, y, form } => Some((
PaintKind::PdfForm { number: form.number },
Bounds {
x: *x,
y: *y - form.height,
width: form.width,
height: form.height + form.depth,
if let Some(placement) = form.xdv {
let [left, bottom, right, top] = placement.bounds;
Bounds { x: *x + left, y: *y - top, width: right - left, height: top - bottom }
} else {
Bounds { x: *x, y: *y - form.height, width: form.width, height: form.height + form.depth }
},
)),
DisplayItem::PdfImage {