Files are processed in your browser, not uploaded. Privacy →
Skip to guide

Extract text

Why is extracted PDF text in the wrong order?

By DeckleUpdated

Extracted PDF text comes out in the wrong order because a PDF stores text in the order it was drawn, not the order you read it. PDF to text follows that stored order, so a two-column page, a sidebar or a form with text boxes can come out with lines from different areas mixed together. Fix it by extracting the affected pages on their own, rearranging the passages in an editor, or going back to the source document when you have it.

PDF to text

A text stream can mix two visual columns

Printed layout

Readers follow each column in its intended order

Plain-text stream

Stored text order may interleave those columns

Changing page order does not repair order inside a page

Conceptual comparison · PDF text extraction does not recreate a tagged reading order or a word-processing layout.

How to find and fix the mixed-up pages

  1. Open PDF to text and choose the PDF, or drop it onto the page.
  2. Choose Choose pages and type one page with columns in Page numbers in output order, for example 4.
  3. Under Between pages, choose Mark where each page ended so you can tell pages apart later.
  4. Choose Extract text, download the TXT file and read it beside the PDF page.
  5. Note what happened: whole columns one after the other, lines alternating between columns, or a sidebar dropped into the middle of a paragraph.
  6. Extract the full document, then fix the affected pages in a text editor, moving whole blocks rather than single lines.

Testing one page first shows you the pattern before you commit to tidying a long file.

Why the order depends on how the PDF was made

A PDF page is a set of drawing instructions: put this text here, that text there. The program that created the PDF decides the sequence. A word processor usually writes the main text from top to bottom, column by column, so extraction reads naturally. Design software often writes each text frame in the order it was created, which may have nothing to do with where it sits on the page.

Deckle reads the stored text, starts a new line when the text moves down the page and puts spaces between words from the gaps between letters. It does not rebuild columns or detect reading order from the page's layout.

Layout Typical result
Single-column letter or report Correct order
Two columns from a word processor Left column, then right column
Newsletter or magazine from design software Frames in creation order; headlines may come after the story
Sidebar or pull quote Inserted between paragraphs of the main text
Form with text boxes Field labels and answers in separate runs
Table Rows read across, with values separated by spaces

Fixes that work

Rearrange blocks in an editor. When each column comes out as one block, the fix is a few cut-and-paste moves per page. Keep Mark where each page ended on, so you know where each page starts.

Extract in page order you control. If the problem is a page sequence rather than columns, such as a summary on the last page that should come first, type the order you want in Page numbers in output order, for example 12, 1-11. How to extract text from specific PDF pages covers this.

Copy column by column. For one or two pages, selecting a single column in a viewer and pasting it is often quicker than fixing the export. How to copy text from a PDF compares the two methods.

Use the source file. If you have the original Word, InDesign or Google Docs file, export the text from there. The source knows the reading order; the PDF may not.

Tips

  • Look at a page with a sidebar. It is the most common place for text to land in an unexpected position.
  • Check headings. In design-software PDFs, a headline is often stored after the article it belongs to.
  • Do not trust line breaks inside columns. Each line on the page becomes a line in the file. Join them into paragraphs after you fix the order.
  • Count a table's columns. If a row has an empty cell, the values after it shift left in the text, so check the numbers against the PDF.

Frequently asked questions

Why does copy and paste give a different order from the export?

Viewers apply their own rules when you select text, and you choose the area by hand. The export reads the whole page in stored order. Both start from the same text.

Can Deckle detect columns automatically?

No. PDF to text keeps the stored order and does not rebuild columns, so check multi-column pages after export.

Does a tagged PDF help?

Not with Deckle. An accessible PDF with tags records a reading order for screen readers, but PDF to text follows the stored drawing order and does not read the tags. Many PDFs have no tags anyway.

Will OCR fix the order?

Not reliably. OCR creates a new text layer from the image and applies its own layout rules, and it adds recognition errors. Use it for scans, not to reorder existing text.

Sources