Field guide
How to Fix Messy PDF Text, Remove Broken Formatting, and Prepare Documents for Portals
Copy a paragraph out of a PDF and paste it somewhere else, and it usually arrives wrecked: sentences chopped into short fragments, words split by stray hyphens, page numbers wedged into the middle of a thought, and gaps wide enough to drive a truck through. The text is not corrupt. It is doing exactly what the file told it to do and once you understand why, fixing it stops being guesswork and becomes a short, repeatable checklist.
Why PDF text breaks when you copy it
A PDF is a page-description format, not a document format. It does not store "a paragraph of forty-two words." It stores instructions that place runs of glyphs at specific coordinates on a canvas: this string at x=72, y=684, in this font, at this size. Everything a reader perceives as structure paragraphs, columns, lists, headings is an illusion produced by where the characters happen to sit.
When software extracts text, it walks that list of positioned runs and turns it back into a string. Every visual line becomes its own fragment, because on the page every visual line genuinely was its own drawing instruction. The result reproduces the page's line wrapping rather than the author's sentence structure. Widen the window in your text editor and nothing reflows, because the breaks are now hard characters rather than layout.
The five extraction errors you will see over and over
Almost every messy extraction is some combination of the same handful of problems:
- Hard line breaks mid-sentence. The most common and the most damaging, because it destroys the sentence boundaries that every downstream tool relies on.
- Hyphenated word splits. Justified text inserts a hyphen when a word straddles a line break. That hyphen is a real character stored in the file, so "infor-" and "mation" arrive as two tokens with punctuation between them.
- Running heads and folios. The chapter title at the top of every page and the page number at the bottom get extracted alongside the body, interrupting the prose every few hundred words.
- Phantom whitespace. Kerning adjustments and tab stops are encoded as positioning, and naive extractors translate that spacing into runs of literal spaces sometimes a dozen in a row.
- Column interleaving. On a two-column page, an extractor that reads in file order rather than reading order can alternate between columns, producing sentences that switch topics halfway through.
The tool above addresses each of these directly. It reconstructs visual lines from glyph coordinates rather than trusting the file's internal ordering, which keeps columns intact; it rejoins a hyphen only when a letter precedes the break and a lowercase letter follows it, so genuine compound words like "state-of-the-art" survive; it merges a line into the one above only when that line lacks terminal punctuation, so headings and list items stay on their own; and it identifies running heads statistically, by normalizing digits out of the top and bottom lines of every page and dropping any pattern that repeats across most of the document.
How applicant tracking systems and document portals read your file
Applicant tracking systems, grant portals, procurement systems, and university application platforms all do roughly the same thing with an uploaded PDF: they run text extraction, then apply pattern matching to the result. They are looking for dates, job titles, section headings, email addresses, degree names, and keywords. What they match against is not your carefully designed layout it is the flat string that extraction produced.
That distinction explains most of the folklore around "ATS-friendly" documents. A resume laid out in two columns can extract as interleaved nonsense, so the parser sees a job title fused to an unrelated date. Contact details placed in a header or footer sometimes fall outside the main content stream entirely and vanish. Text inside a graphic is invisible, because it is a picture, not text. Icons substituted for the words "email" or "phone" leave the parser with a bare string and no label to attach it to. Unusual fonts with broken character maps extract as mojibake the right shapes on screen, the wrong code points underneath.
The practical move is not to guess which layouts are safe. It is to look at what the parser sees. Run your own document through extraction, read the output as plain text, and check three things: is every section heading present and on its own line, do the dates sit next to the roles they belong to, and did your contact details survive? Anything that arrives garbled in the extracted text will arrive garbled in the portal. Fix it in the source document, export a fresh PDF, and check again.
Preparing a document for upload: a short checklist
Before you submit anything to a portal that has a file size cap or a page limit, work through the same sequence:
- Confirm the file has real text. If extraction returns nothing, you have a scan. Run optical character recognition first no amount of cleanup can recover text that was never there.
- Read the extracted text end to end. This is the parser's view of your document. Treat anything confusing in it as a defect in the source file.
- Trim to the pages that were requested. Portals frequently cap uploads at a few megabytes or reject documents over a set page count. Extracting a page range produces a smaller file without re-exporting or degrading the original.
- Keep the page order the reviewer expects. Cover letter, then resume, then references — not whatever order the pages happened to be scanned in.
- Check the file name. Many systems display it verbatim to the reviewer, and a name like final_v7_REAL.pdf is not the first impression you want.
Cleaning text for research, notes, and language models
The same problems bite outside job applications. If you are quoting a paper, hard line breaks mean your quotation will not match the source when someone searches for it. If you are feeding documents into a note system, broken paragraphs destroy the sentence-level chunking that search and retrieval depend on. If you are passing text to a language model, hyphen splits fragment words into tokens the model has to reassemble, wasting context and degrading accuracy. Markdown output helps here specifically: preserving bullet lists as list items and separating paragraphs with blank lines gives downstream tools the structural signals that the PDF threw away.
One habit is worth adopting. After cleaning, skim the first and last few hundred words of the output. Extraction problems cluster at document boundaries cover pages, title blocks, appendices, and footnote blocks are where layout gets unusual and where automated cleanup is most likely to guess wrong. Two minutes of reading catches nearly everything.
A note on privacy
Resumes, contracts, medical records, and legal filings are among the most common documents people need to clean, and they are exactly the documents that should not be uploaded to an unknown server. Everything on this page runs locally: the PDF is parsed inside your browser tab by PDF.js, page extraction is performed by pdf-lib in the same tab, and the file is discarded when you close the page. No copy is transmitted, stored, or retained.
Frequently asked questions
Why does copied PDF text break in the middle of every line?
Because each visual line is stored as its own drawing instruction. Copying reproduces the page's wrapping, not the sentence. Merging wrapped lines rebuilds the paragraph by joining any line whose predecessor ended without terminal punctuation.
Why do words arrive with a hyphen stuck inside them?
Justified typesetting splits long words across lines and writes a real hyphen character into the file. Rejoining hyphenated words removes it but only where a lowercase letter follows, so hyphenated compounds are left alone.
Can it read a scanned PDF?
No. A scan holds an image of text, not text. Extraction returns nothing and the tool tells you so instead of showing an empty box. Run OCR first, then clean the result here.
Are my files uploaded anywhere?
No. Parsing happens in your browser. The file is never sent to a server, and it is discarded when the tab closes.
Does the extracted PDF keep its original quality?
Yes. Pages are copied as complete objects, so fonts, vectors, and images survive untouched. Nothing is re-rendered or recompressed.
Is there a file size limit?
Only what your device can hold in memory. Very large files — several hundred pages take longer because every page is parsed individually, and the progress bar shows where it has reached.