Embed table-cell images at their grid rectangles

This commit is contained in:
gloamxun committed 2026-10-20 02:28:45 +08:00
1 parent d50b4bf560
commit 87a81f16cd
7 files changed
+61 -11

No files matched your search

+4 -2
View File
@@ -1719,6 +1719,7 @@ impl Parser {
raise,
height,
color: None,
image: None,
}),
box_run: None,
unresolved_reference: None,
@@ -2312,8 +2313,8 @@ impl Parser {
return;
}
if let Some(table) = &mut self.table {
// Table-cell images are represented as grey boxes until the cell
// image renderer lands. This still preserves the reference grid.
// Table-cell images reuse the rule box so table layout can keep the
// reference grid; the PDF renderer embeds the source image at this rect.
let width = (0.138_f64 * 160.0 * 72.27 / 25.4 * 65536.0).round() as i32;
let height = (width as f64 * 1.35).round() as i32;
let mut run = Run::plain(String::new());
@@ -2322,6 +2323,7 @@ impl Parser {
raise: common::Scaled(0),
height: common::Scaled(height),
color: Some([170, 170, 170]),
image: Some(path.clone()),
});
table.cell.push(run);
return;