You convert a PDF to Markdown, open the result, and it reads like a puzzle. The report title appears forty times. Page numbers sit in the middle of sentences. A two-column paper jumps from the top of the left column to the top of the right and back again, and half the long words are split with a hyphen. If your PDF to Markdown text comes out of order, you have not done anything wrong. PDFs simply don't store text the way you read it. This guide explains, in plain terms, why that happens, how to spot each problem, how to fix it by hand, and what PDF2MD: PDF to Markdown cleans up for you, and what it doesn't.
Why PDF to Markdown Text Comes Out of Order
PDF to Markdown text comes out of order because a PDF stores text as pieces placed at positions on a page, in whatever order the software that made it drew them, not as a sequence of paragraphs, so any converter has to guess the reading order and the repeated page furniture (headers, footers, page numbers) is mixed in with the content.
Think of a PDF as a very precise set of drawing instructions: "put these characters here, in this font, at this size." Nothing in the file has to say "this is paragraph two" or "this column comes before that one." When you look at the page, your eyes reconstruct the order instantly. When software extracts the text, it has to infer the order from positions, and the inference is often wrong.
That same root cause explains why PDF copy and paste lands in the wrong order, why headers repeat, and why words get split. Each problem has its own fingerprint, so it is worth looking at them one at a time.
The Five Things That Scramble PDF Text
1. Drawing order is not reading order
The app that created the PDF writes text into the file in the order that suited it. A design tool might write the headline last because it was added last. A word processor might write a sidebar box before the main text. A text box moved around in a slide might be stored at the end. Extractors either follow that stored order, or try to sort by position on the page. Neither approach is right every time.
2. Multi-column layouts
Two-column PDFs, such as academic papers, newsletters and magazines, are the classic case. If an extractor reads strictly left to right, line by line, it grabs one line from the left column and then one from the right, producing alternating half-sentences. If it reads in stored order, it may be fine, or it may jump between columns, captions and footnotes. Text boxes, pull quotes and figure captions placed between columns make it worse.
3. Running headers and footers
Most long documents repeat something on every page: a document title, chapter name, company name, "Confidential", a date, a URL. To the PDF, those are just more text on the page. When the pages are joined into one document, that text lands between paragraphs over and over, which is why you see duplicate headers in the Markdown.
4. Page numbers
Page numbers are the same problem in miniature. "14", "Page 14 of 60" or "- 14 -" gets extracted as its own line, then sits in the middle of a paragraph that happened to cross a page boundary. In an AI chat, those stray numbers can even be mistaken for data.
5. Line breaks and hyphenation
A PDF knows where each line ends on the printed page, and extraction usually keeps those breaks. So a paragraph arrives as ten short lines instead of one. When the original was justified or hyphenated, words that wrapped at the end of a line arrive split: "infor-" on one line and "mation" on the next. Ligatures and special characters can add oddities like missing "fi" pairs or strange spaces.
How to Tell Which Problem You Have
Open the Markdown next to the PDF and look for these signs:
- Sentences that stop mid-thought and resume later: a column or text-box ordering problem.
- Alternating fragments that make no sense together: a two-column page read straight across.
- The same short line every page or so: a running header or footer.
- Lone numbers between paragraphs: page numbers.
- Words ending in a hyphen at the end of lines: hyphenation from the original layout.
- No text at all: the PDF is a scan with no text layer. Try to highlight a sentence in your PDF viewer; if you can't, it needs OCR before any converter can help.
A quick check that saves time: select a paragraph in your PDF viewer and copy it into a notes app. If the copy is already scrambled, the problem is in the PDF's structure, and every extractor will struggle with that page to some degree.
How to Fix Scrambled PDF Text by Hand
Remove headers and footers with find and replace
Copy the repeated line exactly, then use your editor's find and replace to replace it with nothing. Do the same for footer text like "Confidential" or a URL. If the header includes a changing page number, a regular expression helps: many editors support patterns such as ^Annual Report 2025 \d+$ to match the header with any number.
Delete page numbers
In an editor with regular expressions, a pattern like ^\d{1,3}$ matches lines that contain only a number. Review the matches before deleting, because a list of short numbers or a table column will match too.
Rejoin hyphenated words
Search for a letter, a hyphen and a line break, followed by a letter, and replace it with the two letters joined. In regex-capable editors that looks like finding (\w)-\n(\w) and replacing with $1$2 (some editors use \1\2). Check a few results, since genuinely hyphenated terms like "long-term" can wrap at the hyphen too.
Fix two-column order
There is no universal trick for columns. Options that work:
- Copy column by column from the PDF viewer, which usually respects the selection area.
- Find a different source. Many papers and reports have an HTML version or a single-column preprint that extracts cleanly.
- For AI use, tell the model. Say "this text was extracted from a two-column PDF and some lines may be out of order." Modern models often cope with mild disorder, but check quotes against the original before you rely on them.
Join broken lines
Markdown treats single line breaks inside a paragraph as spaces when it renders, so short broken lines usually display fine. If they bother you in the raw text, many editors have a "join lines" command. Keep blank lines between paragraphs intact.
What PDF2MD Cleans Up Automatically
PDF2MD: PDF to Markdown extracts the text on your phone, with no uploads, using your device's built-in PDF engine (Apple's PDFKit on iPhone and the PDFBox library on Android), then runs a cleanup pass designed for exactly the problems above. Here is what that pass actually does:
- Repeated headers and footers. It looks at the top and bottom few lines of every page. A line that repeats identically across a large share of pages (at least 40% of them, and at least two) is treated as a running header or footer and removed throughout.
- Running headers with page numbers. Short lines made of words followed by a number, the typical "Chapter Name 14" header, are stripped, while lines like "Step 3" or "Part 2" are kept.
- Standalone page numbers. Lines that are just a short number, or follow patterns like "Page 3", "Page 3 of 10", "3 of 10", "- 3 -" or "[3]", are removed.
- Table of contents dot leaders. Lines like "Introduction ........ 4" become clean list items, and a Contents block is condensed into a tidy list.
- Footnote link clutter. Lines that are only a URL or email address, a common leftover from footnotes, are removed, along with footnote numbers stuck to the end of words.
- Invisible characters and spacing. Zero-width and control characters are stripped, extra spaces are collapsed, and runs of blank lines are reduced.
After converting, the app shows how many headers and footers, page numbers, dot leaders and footnote links it stripped, plus how much smaller the text became, so you can see what changed.
This short video shows the same idea: the repeated "furniture" on every page is what PDF2MD removes before you paste.
PDF2MD: PDF to Markdown
Strip repeated headers, footers and page numbers from PDFs and get clean Markdown on your phone, with no uploads. PDF2MD is a paid app ($4.99 on the US App Store at the time of writing).
Get PDF2MD on iOS & AndroidWhat PDF2MD Doesn't Fix (Yet)
It is better to know the edges before you rely on any converter:
- Column order. PDF2MD uses the reading order your phone's PDF engine reports and does not reorder columns itself. Simple single-column documents come out in order; complex two- and three-column layouts, magazines and brochures may still need the column-by-column fix above.
- Hyphenated words and broken lines. The cleanup does not rejoin words split across lines or merge lines into paragraphs. Use the find-and-replace tip if that matters for your use.
- Headers that change on every page. Detection relies on lines repeating identically, or on the simple "words plus a number" pattern. A header that changes its wording each page may slip through.
- Lone numbers you wanted. A line containing only a short number is treated as a page number, and a short line of words ending in a number looks like a running header, so content that happens to match those shapes can be removed too.
- Scanned PDFs. There is no OCR. If a PDF is a scan with no text layer, the app tells you no selectable text was found, and you'll need an OCR tool first.
- One file at a time. There is no batch conversion.
For headings, lists and footnotes specifically, see our companion guide on PDF to Markdown that keeps headings, nested lists and footnotes. If you're new to the whole idea, start with how to convert PDF to Markdown.
A Simple Workflow for Clean Results
- Check the PDF has real text by highlighting a sentence.
- Convert it in PDF2MD from the Files app or the Share Sheet.
- Read the cleanup counts. Zero headers stripped on a long report is a hint that its header changes page to page.
- Skim page boundaries in the output, where leftovers tend to hide, and any multi-column sections.
- Patch what's left with find and replace, then copy, save as
.md, or share to your notes or AI app.
Scrambled PDF Text FAQ
Why is my PDF copy and paste in the wrong order?
PDFs store text in the order it was drawn, not the order you read it. Multi-column layouts, text boxes and captions make the stored order differ from the visual order, so copy and paste follows the file instead of your eyes.
How do I remove headers and footers when converting PDF to Markdown?
Use find and replace on the repeated line, or a regular expression if it includes a page number. PDF2MD removes lines that repeat identically at the top or bottom of many pages, plus common page number patterns, automatically.
Can PDF2MD fix two-column PDFs?
It doesn't reorder columns itself. It uses the order reported by your phone's PDF engine, which handles some layouts well and others poorly. For complex columns, copy column by column or find a single-column version.
Why are there random numbers in my Markdown?
They are usually page numbers extracted as separate lines. Delete lines that contain only a number, after checking they aren't part of your content.
Does PDF2MD upload my PDF?
No. Text extraction and cleanup happen on your device, and the app works without an internet connection.
Clean the Furniture, Check the Order
Scrambled PDF text has a few predictable causes: drawing order, columns, running headers and footers, page numbers and hyphenation. The page furniture is easy to strip automatically; reading order on complex layouts still deserves a human glance. Knowing which is which turns a frustrating mess into a five-minute tidy-up.
If you'd rather not hunt down headers and page numbers by hand, try PDF2MD: PDF to Markdown on your next document and spend your time on the parts that actually need you.