Summary
empty_sheet_context() (crates/office2pdf/src/parser/xlsx.rs:212) hardcodes
max_digit_width_px: 7.0 and normal_font: None, so anchored_image and
anchored_text_box never see the workbook's Normal font on a sheet whose <sheetData/>
is empty. Every such sheet is laid out on 44.2575pt columns, which is exactly
column_width_to_pt(8.43, 7.0).
These workbooks declare Calibri 11, for which office2pdf's own
max_digit_width_px_for_normal_font returns 8.0 px → 50.58pt. The drawing-only sheets are
therefore laid out 12.5% narrower than the converter's own font model says they should be,
with no GT needed to see the inconsistency.
Measured
Column width solved from anchor geometry on two independent fixtures — two equations, no
global scale factor involved:
| fixture |
anchors |
solve |
result |
WithDrawing |
clock.jpg twoCellAnchor col 0→3; tomcat.png col 8→10 + 19050 EMU |
3C = 132.7725, 2C + 19050/12700 = 90.015 |
C = 44.2575, offset unscaled |
WithTextBox |
WithTextBox anchor col 2→7 + 21.75pt |
5C + 21.75 = 243.04 |
C = 44.2575 |
|
expected (Calibri 11, 8.0 px) |
office2pdf (hardcoded 7.0 px) |
| column width |
50.58pt |
44.2575pt (−12.5%) |
| columns fitting A4's 494.5pt printable width |
9 |
11 |
WithDrawing pages |
2 |
1 |
clock.jpg rendered size (source 192×176, a:ext 144×132pt) |
aspect 1.091 |
132.77 × 132pt, aspect 1.006 (−8%) |
WithDrawing's content reaches column 11, so the printout collapses from two pages to one
and the two pictures Excel splits across the horizontal page break (tomcat.png,
santa.wmf) are drawn whole on page 1. Pictures are also squashed horizontally: only the
width comes from the bad column model, while the height comes from row heights, so the
aspect ratio is distorted by 8%.
This is not the fit-to-width path: WithDrawing, WithTextBox and WithChart carry no
<pageSetup> at all, so sheets_fitting_to_page never matches and no fit scale is applied.
Reproduction
cargo run -p office2pdf-cli -- tests/fixtures/xlsx/poi/WithDrawing.xlsx -o out.pdf
pdfinfo out.pdf | grep Pages # 1; Excel prints 2
mutool draw -F trace -o - out.pdf 1 | grep -i image
Expected
A sheet with no cells still resolves its drawing anchors against the workbook's Normal font,
producing the same column metric as a sheet that happens to have cells in it.
Actual
empty_sheet_context() substitutes a 7.0 px digit width and drops the Normal font, so every
drawing-only sheet is 12.5% narrow, pictures are 8% aspect-distorted, and a two-page sheet
collapses to one.
Related: #460, #473
Found in the 2026-07-29 full-corpus visual audit at c1adfbd (native Office GT, 150 DPI, mutool-trace geometry).
Visual comparison
| Compare |
 |
GT left, office2pdf right, 150 DPI, same page.
Summary
empty_sheet_context()(crates/office2pdf/src/parser/xlsx.rs:212) hardcodesmax_digit_width_px: 7.0andnormal_font: None, soanchored_imageandanchored_text_boxnever see the workbook's Normal font on a sheet whose<sheetData/>is empty. Every such sheet is laid out on 44.2575pt columns, which is exactly
column_width_to_pt(8.43, 7.0).These workbooks declare Calibri 11, for which office2pdf's own
max_digit_width_px_for_normal_fontreturns 8.0 px → 50.58pt. The drawing-only sheets aretherefore laid out 12.5% narrower than the converter's own font model says they should be,
with no GT needed to see the inconsistency.
Measured
Column width solved from anchor geometry on two independent fixtures — two equations, no
global scale factor involved:
WithDrawingclock.jpgtwoCellAnchor col 0→3;tomcat.pngcol 8→10 + 19050 EMU3C = 132.7725,2C + 19050/12700 = 90.015C = 44.2575, offset unscaledWithTextBoxWithTextBoxanchor col 2→7 + 21.75pt5C + 21.75 = 243.04C = 44.2575WithDrawingpagesclock.jpgrendered size (source 192×176,a:ext144×132pt)WithDrawing's content reaches column 11, so the printout collapses from two pages to oneand the two pictures Excel splits across the horizontal page break (
tomcat.png,santa.wmf) are drawn whole on page 1. Pictures are also squashed horizontally: only thewidth comes from the bad column model, while the height comes from row heights, so the
aspect ratio is distorted by 8%.
This is not the fit-to-width path:
WithDrawing,WithTextBoxandWithChartcarry no<pageSetup>at all, sosheets_fitting_to_pagenever matches and no fit scale is applied.Reproduction
Expected
A sheet with no cells still resolves its drawing anchors against the workbook's Normal font,
producing the same column metric as a sheet that happens to have cells in it.
Actual
empty_sheet_context()substitutes a 7.0 px digit width and drops the Normal font, so everydrawing-only sheet is 12.5% narrow, pictures are 8% aspect-distorted, and a two-page sheet
collapses to one.
Related: #460, #473
Found in the 2026-07-29 full-corpus visual audit at c1adfbd (native Office GT, 150 DPI, mutool-trace geometry).
Visual comparison
GT left, office2pdf right, 150 DPI, same page.