complete.tools

Repair Broken PDF Text

Fix text copied from a PDF: rejoin words split across lines, remove hard line breaks, replace ligatures and tidy odd spaces.

What this tool does

Fix text copied from a PDF: rejoin words split across lines, remove hard line breaks, replace ligatures and tidy odd spaces. You fill in these fields: Text copied from the PDF. Tick boxes adjust the calculation. It shows repaired text, split words rejoined, line breaks joined, and ligatures replaced.

Inputs

  • Text copied from the PDF: Longer text, up to 100000 characters.
  • Rejoin words split across lines: A tick box, ticked to start. A line ending in a letter and a hyphen is joined to the next line. If the next line starts in lowercase the hyphen is dropped. If it starts in capitals the hyphen is kept.
  • Join lines inside a paragraph: A tick box, ticked to start. A single line break becomes a space. Blank lines between paragraphs, and lines that start like a list item, are kept.
  • Replace ligature characters: A tick box, ticked to start. Turns the single-character forms of ff, fi, fl, ffi, ffl and st back into ordinary letters.
  • Tidy spaces: A tick box, ticked to start. Turns unusual spaces into normal ones, deletes zero-width spaces, byte order marks and soft hyphens, collapses repeated spaces and blank lines, and trims each line.

How to use

  1. Type the text copied from the PDF.
  2. Tick "Rejoin words split across lines" if it applies.
  3. Tick "Join lines inside a paragraph" if it applies.
  4. Tick "Replace ligature characters" if it applies.
  5. Tick "Tidy spaces" if it applies.
  6. Read the result: repaired text, split words rejoined, line breaks joined, and ligatures replaced. It appears once every required field has a valid value.
  7. Use the copy button to copy the text.

Worked examples

Example 1. Inputs:

  • Text copied from the PDF: "The office file and the flag."
  • Replace ligature characters: Yes

Results:

  • Split words rejoined: 0
  • Line breaks joined: 0
  • Ligatures replaced: 3

How this is worked out: Unicode presentation forms: U+FB03 is the ffi ligature, U+FB01 is fi, U+FB02 is fl. Each is replaced by its letters, giving office, file, flag. Three ligatures were in the text, so 3 replacements.

Example 2. Inputs:

  • Text copied from the PDF: "The Anglo- Saxon rule"
  • Rejoin words split across lines: Yes
  • Join lines inside a paragraph: Yes

Results:

  • Split words rejoined: 1
  • Line breaks joined: 0
  • Ligatures replaced: 0

How this is worked out: The first line ends with o and a hyphen. The next line starts with a capital S, so the hyphen belongs to the word and is kept: Anglo-Saxon. One rejoin, and no line break is left to join.

Example 3. Inputs:

  • Text copied from the PDF: "1. First point that wraps here 2) Second point * Third"
  • Join lines inside a paragraph: Yes

Results:

  • Split words rejoined: 0
  • Line breaks joined: 1
  • Ligatures replaced: 0

How this is worked out: Line 2 does not start like a list item, so it joins the numbered item above it with a space: 1 join. Line 3 starts with a digit, a closing bracket and a space, and line 4 with an asterisk and a space, so both are list items and stay on their own lines.

Example 4. Inputs:

  • Text copied from the PDF: "The first para- graph ends here. Well- known case"
  • Rejoin words split across lines: Yes
  • Join lines inside a paragraph: Yes
  • Replace ligature characters: Yes
  • Tidy spaces: Yes

Results:

  • Split words rejoined: 2
  • Line breaks joined: 0
  • Ligatures replaced: 1

How this is worked out: Every repair on, with Windows line endings.The fi ligature (U+FB01) becomes fi: 1. para- joins graph (lowercase, hyphen dropped): paragraph, 1 rejoin. Two blank lines follow, so nothing joins across them. Well- joins known (lowercase, hyphen dropped), which gives Wellknown, the stated weakness with real compound words: 2 rejoins in all. No single line break is left inside a paragraph, so 0 joins. Tidy spaces turns the runs of spaces into one and the two blank lines into one. 1 + 2 + 0 = 3 repairs.

Limitations

  • The rules are heuristics. The tool cannot see the PDF layout, so headings and short lines that are not list items may be joined to the line before them.
  • A numbered line in the middle of a paragraph, for example a wrapped line that starts with a number and a dot, is kept on its own line.
  • In text set in capital letters a split word keeps its hyphen, because the next line starts with a capital.
  • Rejoining a split word merges the two lines even when Join lines inside a paragraph is unticked.
  • Spaces at the end of a line are removed even when every repair is unticked.
  • Columns, tables and page headers copied from a PDF are not detected.
  • Text longer than 100,000 characters is not accepted.
  • This tool gives an estimate. It is based on a general model, not on an exact published formula, so a real figure can differ from the result.

FAQs

Q: Why does a hyphen sometimes stay when I rejoin a split word?
A: If the next line starts with a capital letter or a digit, the hyphen is assumed to be part of the word, as in Anglo-Saxon, so it is kept and the two parts are joined with no space. If the next line starts in lowercase, the hyphen is assumed to be a break inside a word and is removed.
Q: What if a compound word such as well-known was split across two lines?
A: The tool cannot tell it from an ordinary split word, so the hyphen is dropped and you get wellknown. Check compound words in the result.
Q: Which lines are treated as list items?
A: Lines that start with a dash, asterisk or bullet followed by a space, or with one to three digits and a dot or closing bracket followed by a space. They are kept on their own line instead of being joined to the line above.
Q: Does it fix garbled characters or scanned text?
A: No. It repairs line breaks, split words, ligatures and spaces in text that was extracted correctly. Wrong letters from a bad encoding or from scanning are not corrected.

Explore Similar Tools

Explore more tools like this one: