Write native pdfTeX Form XObjects

This commit is contained in:
gloamxun committed 2026-11-27 15:06:44 +08:00
1 parent 7ff988031f
commit c2d3312e5a
23 files changed
+534 -88

No files matched your search

+12 -2
View File
@@ -109,6 +109,11 @@ pub enum DisplayItem {
image: std::sync::Arc<crate::pdf_image::PdfImageUse>,
},
PdfImageObject(crate::pdf_image::PdfImageObject),
PdfForm {
x: i64,
y: i64,
form: crate::pdf_device::forms::FormUse,
},
Rect {
x: i64,
y: i64,
@@ -261,6 +266,8 @@ pub struct DisplayList {
pub width: i64,
pub height: i64,
pub items: Vec<DisplayItem>,
#[doc(hidden)]
pub forms: Vec<crate::pdf_device::forms::FormDisplay>,
/// Captured VF packets from native shipout, indexed by the raw display
/// item. None leaves lookup to a standalone renderer.
#[doc(hidden)]
@@ -287,6 +294,7 @@ impl Default for DisplayList {
width: 0,
height: 0,
items: Vec::new(),
forms: Vec::new(),
prepared_virtual_glyphs: None,
sources: Default::default(),
images: Vec::new(),
@@ -338,7 +346,7 @@ impl DisplayList {
|| self
.items
.iter()
.any(|item| matches!(item, DisplayItem::PdfImage { .. }
.any(|item| matches!(item, DisplayItem::PdfImage { .. } | DisplayItem::PdfForm { .. }
| DisplayItem::PdfGraphics {
operation: crate::pdf_device::PdfGraphics::Literal { .. },
..
@@ -434,6 +442,7 @@ impl DisplayList {
| DisplayItem::Frame { x, y, .. }
| DisplayItem::Image { x, y, .. }
| DisplayItem::PdfImage { x, y, .. }
| DisplayItem::PdfForm { x, y, .. }
| DisplayItem::PdfGraphics { x, y, .. }
| DisplayItem::PdfTextSpace { x, y, .. }
| DisplayItem::Link { x, y, .. } => {
@@ -855,7 +864,7 @@ impl DisplayList {
));
}
DisplayItem::PdfImage { .. } => unreachable!("checked before SVG export"),
DisplayItem::PdfImageObject(_) => {}
DisplayItem::PdfImageObject(_) | DisplayItem::PdfForm { .. } => {}
DisplayItem::Image {
x,
y,
@@ -1697,6 +1706,7 @@ impl Page {
width: scaled(*width),
height: scaled(*height),
},
MathItem::PdfForm(form) => DisplayItem::PdfForm { x, y, form: *form },
MathItem::PdfImage(image) => DisplayItem::PdfImage {
x,
y: y - scaled(image.height),