Summary
This issue tracks the Java DOCX renderer session that brought 14_Thesis_Chapter to near-pixel parity with Microsoft 365 Word.
| Metric |
Before |
After |
| 14_Thesis_Chapter overall |
0.9856 |
0.9932 |
| 14_Thesis_Chapter text similarity |
0.9979 |
1.0 |
| 14_Thesis_Chapter visual |
- |
0.983 |
| Pages |
2/2 |
2/2 |
| Full issue/docx benchmark average |
0.7225 |
0.7224 (28 cases) |
| Unit tests |
20/20 |
78/79 (issues66 CJK smoke test now passes; 1 pre-existing Vietnamese issue91 extraction failure remains) |
Session Flow
- Diagnose remaining image differences between
minipdf, Word reference, and LibreOffice renders of 14_Thesis_Chapter p1: headings not bold, bullets missing, body lines wrapped wider than Word, table offset, and wrong page-break position.
- Heading bold — port Word's effective bold: paragraph-mark
pPr/rPr and paragraph style rPr (CTParaRPr / CTRPr).
- Bullet markers — resolve
numPr → abstractNum → lvl via XWPFNumbering; map Symbol PUA bullet (\uF0B7) to •.
- Heading color — apply paragraph-style
rPr/w:color (Heading2 blue 4F81BD) when runs carry no explicit color.
- Width metrics — mirror
DocxToPdfConverter.EstimateCalibrTextWidth/EstimateWrapTextWidth:
- Calibri-default documents: Times table with -8.8 units/letter kerning for serif runs, Calibri ×0.977 otherwise.
- Other defaults: wrap with actual TTF advances (
PDType0Font#getStringWidth), since Word lays out with the same TTF metrics.
- Center/right alignment positioned with actual font advances.
- Paragraph flow parity —
contextualSpacing collapse between same-style paragraphs, keepNext widow control (reserve heading + up to 3 follow lines), top-of-page baseline = margin + font ascent, spacing-before suppressed at page top, spacing-after not collapsed across tables.
- Table parity — auto-width table indent -108 twips (Word default), cell vertical margin 0, table spacing tuned to Word/LibreOffice measurements.
- Bullet line height — Symbol-font labels advance 16.7pt (factor 1.21) matching Word and LibreOffice.
All changes are in minipdf-java/minipdf/src/main/java/io/github/minisoftware/minipdf/internal/docx/PoiDocxRenderer.java.
Validation
mvn -B -ntp -f minipdf-java/pom.xml test → 78/79 passing.
Run-Java-VisualBenchmark.ps1 -Suite issue -Format docx -SkipReference → 0.7224 average; 14_Thesis 0.9932, Issue79 0.9911/0.991, issues66 0.9879, Support_Letter 0.9761.
Summary
This issue tracks the Java DOCX renderer session that brought
14_Thesis_Chapterto near-pixel parity with Microsoft 365 Word.issues66CJK smoke test now passes; 1 pre-existing Vietnamese issue91 extraction failure remains)Session Flow
minipdf, Word reference, and LibreOffice renders of14_Thesis_Chapterp1: headings not bold, bullets missing, body lines wrapped wider than Word, table offset, and wrong page-break position.pPr/rPrand paragraph stylerPr(CTParaRPr/CTRPr).numPr→abstractNum→lvlviaXWPFNumbering; map Symbol PUA bullet (\uF0B7) to•.rPr/w:color(Heading2 blue4F81BD) when runs carry no explicit color.DocxToPdfConverter.EstimateCalibrTextWidth/EstimateWrapTextWidth:PDType0Font#getStringWidth), since Word lays out with the same TTF metrics.contextualSpacingcollapse between same-style paragraphs,keepNextwidow control (reserve heading + up to 3 follow lines), top-of-page baseline = margin + font ascent, spacing-before suppressed at page top, spacing-after not collapsed across tables.All changes are in
minipdf-java/minipdf/src/main/java/io/github/minisoftware/minipdf/internal/docx/PoiDocxRenderer.java.Validation
mvn -B -ntp -f minipdf-java/pom.xml test→ 78/79 passing.Run-Java-VisualBenchmark.ps1 -Suite issue -Format docx -SkipReference→ 0.7224 average; 14_Thesis 0.9932, Issue79 0.9911/0.991, issues66 0.9879, Support_Letter 0.9761.