PDF text repair

Repair PDF line breaks without flattening the document

A PDF stores the position of text on a page, not necessarily the paragraph structure a word processor would keep. Copying a paragraph can therefore place a newline at every visual edge. Replacing every newline with a space looks tempting, but it also destroys headings, lists, quotations, and table rows.

A safer repair separates visual wrapping from structural boundaries. TextClean uses narrow rules that can be reproduced and checked against the original.

Before

First line of a para-
graph continues here.
Still here.

Second paragraph.

After

First line of a paragraph continues here. Still here.

Second paragraph.

Why copied PDF text breaks

PDF generators commonly place individual text fragments at coordinates. The viewer knows where to draw each fragment, but copying must guess the reading order. A narrow column, justified text, footnote, or multi-column layout can produce line endings that were never intended as paragraph boundaries.

The visible page can still look perfect. The damage appears only after pasting into email, a document, a content system, or a search field.

The conservative repair rule

TextClean divides the input at blank lines first. Within each block, ordinary wrapped lines are joined with a space. Blank lines remain paragraph boundaries. Lines that look like headings, list items, code, or pipe-delimited table rows remain separate.

A word split with a hyphen is rejoined only when a letter appears before the line ending and the next line begins with a lowercase letter. This repairs para- followed by graph, but it does not pretend to understand every compound word or proper name.

  • Keep blank lines between paragraphs.
  • Keep bullets and numbered items on separate lines.
  • Keep all-cap headings and pipe-delimited rows separate.
  • Join ordinary prose lines with spaces.
  • Review every removed end-of-line hyphen.

Headers, footers, and page numbers

Repeated page edges can enter the middle of copied text. TextClean removes a header or footer only when a similar boundary line appears on enough form-feed-separated pages. Page-number removal is limited to lines that look like a number, a Roman numeral, or a simple page count.

Those rules deliberately leave uncertain lines alone. A year, section number, or meaningful short line can resemble a page number, so the result must still be compared with the source.

Cases that need manual review

Multi-column pages, poetry, source code, legal citations, bibliographies, and tables can use line position as meaning. Scanned PDFs require OCR before text repair can begin. No line-joining rule can reconstruct a visual layout that the copied text never exposed.

Keep the PDF open, repair a short sample, and compare headings, numbers, citations, and list order before cleaning the complete selection.

Check before using the result

  • Paragraph count
  • Headings and list boundaries
  • Names split across lines
  • Page numbers and repeated headers
  • Tables, code, citations, and footnotes

Open PDF text repair