1001Ferramentas
📄 Text

Pasted PDF Text Cleaner

Rebuilds paragraphs from text copied out of a PDF: rejoins broken lines, undoes end-of-line hyphenation and strips page numbers and repeated headers.

Everything runs inside your browser: the text is never uploaded anywhere.

Cleanup steps

Why pasted PDF text breaks

A PDF has no paragraphs: it stores glyphs positioned on a page. When you select and copy, the viewer turns each visual line into a real line break, so a paragraph arrives chopped every 70 or 80 characters, with the hyphen the typesetter used to split a word still stuck in the middle of it.

The tricky part is telling a line that continues the paragraph from one that ends it. The rule used here looks at the punctuation at the end of the line and at its length compared with the median line of the document: a line much shorter than the others is almost always the last one of a paragraph, a title or a list item.

Why text copied from a PDF arrives broken

A PDF stores glyphs positioned on a page, not paragraphs. When you select a passage and copy it, the viewer turns every visual line into a real line break, so the paragraph lands chopped every seventy characters. The hyphen the typesetter used to split a word at the end of a line comes along too, which is how a sentence about a compositor shows up as compo-sitor in the middle of your document.

The hard part is not joining lines, it is deciding which ones to join. Two signals do the work here: the punctuation ending the line, and its length compared with the median line of the document. A line ending in a period, a colon or a closing parenthesis closes the paragraph; a line much shorter than its neighbours is almost always the last of a block, a heading or a list item, so it stays put.

One surprise hides in the characters themselves: fi and fl often arrive as a single glyph, the typographic ligature the font uses to tuck the letters together. The text looks fine on screen, yet searching for fiscal in Word finds nothing and the spell checker flags the whole word. Journal headers repeated on every page and stray page numbers stuck inside a sentence get cleaned in the same pass.

Frequently asked questions

Why is there a hyphen inside my words?
Because the hyphen was in the PDF. To justify the text, the typesetter split the word at the end of the line, and that hyphen belongs to the file, not to the word. Copying brings it along. The cleaner drops the hyphen when the next letter is lowercase and keeps it when the next letter is uppercase, so compound surnames such as Silva-Santos survive.
How are repeated headers detected?
Any short line that shows up three times or more in the pasted text, with digits ignored, is treated as a header or footer. That way User Manual 1, User Manual 2 and User Manual 3 count as one group. The minimum number of repetitions is adjustable, and the report names each removed line together with how many times it appeared.
Is the pasted text sent to a server?
No. Everything runs in your browser in JavaScript, with no network request at all. Turn the connection off before pasting and the cleanup still works. That matters when the excerpt comes from a contract, a medical report or a paper that has not been published yet.

Related Tools