Repository navigation
Fix centered PDF title reading order - #17009
Conversation
📝 WalkthroughWalkthroughThe PDF layout pipeline now promotes eligible isolated leading titles after column-bucketed vertical merging. New tests verify centered-title placement and preserve expected ordering for multi-column body and title boxes. Parser comments describe the updated column-major ordering behavior. ChangesPDF reading-order correction
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This is a clean fix for the reading-order regression in #16820, and the test coverage (81 lines covering centered titles, two-column layouts, and non-leading column headings) is exactly the right breadth. From a document-provenance perspective, the key design choice here is correct: distinguish a page-leading isolated-column title from genuine multi-column body content, and re-order only the former. A blanket "interleave all columns" fix would have broken legitimate two-column layouts; a blanket "keep column-major" fix would have left the title displacement in place. The targeted approach preserves both reading models. One observation worth surfacing for the broader PDF pipeline: the centered-title case is the canonical example of why layout position alone is insufficient as a structural-identity signal. The title carries "document identity" semantics (it's what a citation anchor like "as set forth in the Master Services Agreement" resolves to), but its x-coordinate puts it in a separate column cluster — so a purely geometric ordering model silently demotes the single most load-bearing element. The fix correctly treats it as a special case, but the underlying pattern (a structurally-important element whose position doesn't match its role) will recur: signature blocks at page bottoms, exhibit labels in margins, footer-defined terms. A durable companion would be a Good that the fix also touches |
|
@zcxGGmu The fix looks good. May I ask your help to provide some e2e testing evidence with a real PDF before & after fix? That means, before fix, the PDF parsing result is not good; after fix, the PDF parsing result should be improved. Thank you. |
|
I captured a real-PDF before/after check using the existing fixture PDF evidence source:
Before fix ( After fix ( Validation commands:
I also tried the full manual PDF package command, but this checkout currently does not build that package locally because unrelated manual test files have compile errors ( |
Summary
Closes #16820.
Tests
The full PDF integration package could not be linked locally because the existing macOS native archives for pdfium, office_oxide, and pdf_oxide are malformed.