Why does text extracted from a PDF break in the middle of sentences instead of flowing as paragraphs?

Because a PDF stores each printed line as text at a set position on the page, with no idea of a paragraph. So each line comes back exactly as it appeared, even when a sentence breaks halfway. The tool adds an empty line only where the vertical gap is clearly bigger than the usual line spacing, about 1.6 times, which marks paragraphs. Join the lines of each paragraph when you paste into a flowing format.

Published · 3 min read

The paragraph is not in the file

When you type a paragraph in Word, Word knows it is one unit and decides where lines wrap based on the page width. Exporting to PDF freezes those decisions: line one ends at a particular word, line two starts at a set spot below it. The file keeps only the visible result. So no reading tool can know for certain where a paragraph ends, but it can make a good guess from the spacing.

How the tool spots paragraphs

Once the lines are rebuilt, the tool measures the vertical distance between each pair of neighbouring lines and takes the middle value as the normal line step. Any gap about 1.6 times bigger than that means a new paragraph, so an empty line goes in front of it.

Worked example

Three lines of 12 point text at heights 700, 688 and 676, then a fourth line at 640.

The normal step is 12, and the gap before line four is 36, more than 1.6 × 12 = 19.2, so an empty line appears before line four.

The result: Our store ships across Saudi, then Arabia within three working, then days of your order., then an empty line, then Returns are free for 14 days.

Had the fourth line sat at 660, a gap of 16, it would not count as a new paragraph and all four lines would run on.

Getting the paragraphs to flow again

The goal is to join the lines of each paragraph into one line while keeping the empty lines as paragraph separators. In Word you can do that with Find and Replace in three passes:

  1. Extract the text with the PDF text extractor in combined mode and paste it into a new document as plain text.
  2. Replace every double paragraph mark ^p^p with a placeholder that does not occur in the text, such as ###.
  3. Replace every remaining ^p with a space, which joins the lines of each paragraph.
  4. Replace ### with a paragraph mark ^p, which restores the breaks between paragraphs.

After joining, you may see double spaces where a line ended in a space. Run the text through the Whitespace cleaner to even them out. That tool tidies spaces and blank lines but does not join lines, so the joining happens in your editor.

When not to join lines

  • Lists and tables: every line has its own meaning, such as an item and its price.
  • Headings and subheadings: usually a line on their own, and they should stay that way.
  • Words hyphenated at the end of a line: if the file splits long words, joining leaves the hyphen inside the word, so check them.

Common questions

Why did no paragraph breaks appear in my file at all?

If the file separates paragraphs with a gap close to the normal line spacing, the gap never reaches 1.6 times, and the paragraphs run together.

Is it different for Arabic text?

The same rule applies to the heights, but the word order inside an Arabic line may need checking in some files.

Does Page by page mode change the paragraphs?

No. Paragraphs are worked out within each page in the same way; the mode only decides whether page headings are added.