Copy a paragraph out of a PDF and paste it into an email or a document, and it often arrives as a column of short lines, each ending where the line ended on the printed page. Hyphenated words stay split and page numbers land mid-sentence. This guide explains why that happens and how to turn the text back into clean paragraphs.
Step by step
- Copy the text from the PDF and paste it into Remove Line Breaks.
- Under Replace line breaks with, keep A space for normal prose. Choose Nothing for text where lines were split mid-word without hyphens, or Custom text to join lines with a separator such as
,. - Leave Keep paragraph breaks on so that blank lines between paragraphs survive as a single blank line, while every other line break is joined.
- Leave Trim each line and Collapse repeated spaces on to remove the stray spaces PDFs often leave at line ends.
- Tick Fix hyphenated breaks (exam-ple → example) if the PDF hyphenates words at line ends.
- Compare the Lines before and Lines after counts, read through the result, and copy or download it.
Everything runs in your browser, so you can clean up text from contracts, reports or research papers without uploading them.
Why PDF text has so many line breaks
A PDF describes a printed page, not a flowing document. It records where each run of characters sits, line by line, usually with no notion of a paragraph. When you copy text, the viewer rebuilds the reading order from those positions and puts a line break at the end of each printed line. Emails and plain-text files wrapped at 72 or 80 characters behave the same way, and the same fix works for them.
Several other artifacts come along for the ride:
- Hyphenated words split across lines, such as
docu-andment. - Running headers and footers, such as the document title or chapter name, repeated on every page.
- Page numbers on lines of their own.
- Ligatures copied as single characters, such as
fiandflinstead offiandfl, which look right but break searching and spell checking. - Soft hyphens (an invisible character, U+00AD) left inside words.
Keeping paragraphs while removing line breaks
The key is telling apart a break that ends a printed line, which should go, from one that ends a paragraph, which should stay. Most PDFs separate paragraphs with an empty line when copied, so with Keep paragraph breaks on, the tool treats one or more blank lines as a paragraph boundary and joins everything else:
Before:
The committee met on 12 March to review
the proposal. After a long discussion it
agreed to proceed with the second option.
Members asked for a revised budget by
the end of the month.
After:
The committee met on 12 March to review the proposal. After a long discussion it agreed to proceed with the second option.
Members asked for a revised budget by the end of the month.
Some PDFs, especially those with indented paragraphs and no spacing, copy without any blank lines between paragraphs. Then there is nothing to tell the two kinds of break apart, and everything becomes one block. Two ways to handle that:
- Join only the lines that do not end a sentence. In find and replace, turn on Regular expression, find
([^.!?:])\nand replace with$1(with a space after it). Every line break that follows something other than.,!,?or:becomes a space, and lines that end a sentence stay where they are, so each paragraph ends up on its own line. A paragraph in which a sentence happens to end at the end of a printed line will be split in two, so read through the result. - Join everything, then add the few paragraph breaks back by hand. For short passages this is often faster.
Fixing hyphenated line breaks
Typeset PDFs often hyphenate long words at the end of a line. With Fix hyphenated breaks on, the tool joins a line that ends in a letter followed by - with the next line when that next line starts with a lower-case letter, removing the hyphen. So docu- + ment becomes document.
The lower-case rule protects terms like Franco- + Prussian. It cannot tell, though, whether a hyphen belongs to the word. A genuinely hyphenated term that happens to break at its hyphen, such as self- + aware, also becomes selfaware. After joining, search the result for words that look wrong. A find and replace for selfaware → self-aware fixes every occurrence at once.
If the PDF used soft hyphens instead of visible ones, the words may already look joined but contain an invisible character that breaks searching. Remove them with find and replace in regex mode: find \u00AD and replace with nothing.
Cleaning up headers, page numbers and leftovers
Do this cleanup before joining lines, while each header and page number is still on its own line and easy to match. A good order of work:
- Remove page numbers. In find and replace, turn on Regular expression and the m multiline flag, find
^[ \t]*\d+[ \t]*$and replace with nothing. That empties every line that contains only a number. If pages are numbered likePage 4 of 12, use^Page \d+ of \d+$. - Remove running headers. If the header is the same text on every page, a plain-text find and replace with an empty replacement removes every copy. Make sure the text does not also appear inside the body, and turn on Match case if that helps keep the two apart.
- Fix ligatures. Replace
fiwithfiandflwithflin plain-text mode. Copy the ligature character from your pasted text to search for it. - Join the lines with Remove Line Breaks as described above. Empty lines created by the first two steps are handled: a run of blank lines counts as a single paragraph break, and with Keep paragraph breaks off they are dropped. Where a page break fell in the middle of a paragraph, the emptied lines leave a false paragraph break; join those few by hand.
For a list rather than prose, such as names or references copied from a table, keep one item per line. Join only the broken items, then use Remove Duplicate Lines to drop repeated entries (with Case sensitive off if Smith and SMITH should count as the same), and Sort Lines to put them in order.
Tip Some viewers interleave lines from both columns of a two-column PDF. Joining lines will not fix that; select one column at a time instead.
When the text is clean, the word counter checks its length (see how to count words and characters). To combine whole documents instead, read how to merge PDF files.