Skip to content

🐛 Restore spaces across tightly spaced PDF lines - #228

Merged
lindsey-pony[bot] merged 1 commit into
mainfrom
vapor-trail-pdf-line-wraps
Nov 16, 2026
Merged

lindsey-pony[bot] merged 1 commit into
mainfrom
vapor-trail-pdf-line-wraps

Conversation

@JFWooten4

Copy link
Copy Markdown
Member

Summary

  • Restore word boundaries in copied text from closely spaced, untagged PDF text lines by detecting line advances as small as 0.8× the text height, rather than requiring more than 1.3×.
  • Avoid inserting a continuation space when the next text run moves right into a different newspaper-style column.
  • Add a regression test for the exact sentence on PDF page 65 (printed page 15913) of the April 23, 1985 Federal Register.

Reproduction

GovInfo Federal Register PDF, page 65

Before: **Exempt transferagents would only be required toprovide identifying information andprovide responses to two basicquestions**

Expected: **Exempt transfer agents would only be required to provide identifying information and provide responses to two basic questions**

The extracted PDF text runs can omit both a trailing space and an explicit PDF.js end-of-line marker. When those runs advance by about one text height, the existing line-wrap heuristic does not insert a separator, and Markdown copy joins adjacent words. This change preserves the existing treatment of explicit spaces, hyphenated endings, paragraph tags, and columns.

Verification

  • Inspected the current viewer copy-formatting implementation.
  • Confirmed the correctly spaced text appears in GovInfo's indexed rendition of printed page 15913.
  • Verified the commit differs from its parent and changes only src/viewer/selection/markdown-copy.js and tests/markdown-copy.test.mjs.
  • Added a five-line tightly spaced PDF text fixture and a negative test for column transitions.
  • A live browser copy against the full 34 MB PDF and CI test execution have not been completed during this change.

Write PR descriptions automatically.

Repair clipboard spacing for older Federal Register OCR when adjacent printed baselines are separated by about one text height. Avoid joining different columns and cover the 50 FR 15913 passage with a regression test.

Co-authored-by: ChatGPT 6 <noreply@openai.com>
@lindsey-pony
lindsey-pony Bot merged commit d53af17 into main Nov 16, 2026
14 checks passed
@lindsey-pony
lindsey-pony Bot deleted the vapor-trail-pdf-line-wraps branch November 16, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant