Two-Column PDF Read as One Column? Keep the Coordinates

The left column is read halfway through when the next sentence abruptly transitions to the formula explanation in the right column. Such issues do not necessari

If you translate or extract text from a two-column PDF, you may find that the left column stops halfway, and the next sentence jumps into the right column's formula explanation. The words are usually all correct. The problem is their order, and it is easy to miss when you only skim the output.

This guide is for anyone who processes academic papers, reports, or other multi-column documents with Python or a translation tool. It explains why the order breaks, how to keep the coordinates that prevent it, and how to check the result before you trust it on a whole batch.

You will get a short, runnable example, a checklist for acceptance testing, and a plan for rolling the approach out one page at a time.

How do you keep the reading order of a two-column PDF? The short answer

Keep each text block's coordinates and source page, sort by column region, and check the output against a clear set of acceptance criteria before you rely on it.

Your situationWhat to doWhy
The left column breaks off and the right column's text followsPreserve each block's coordinates and source page before any other stepThe ordering problem comes from position, not from wrong words
You are working with a typical two-column paperRead the full left-column section before moving to the right columnInterleaving the columns line by line at the same height breaks paragraph structure
You expect sort=True to fix everythingCompare sorted and unsorted output on each pagesort is not a layout interpreter and cannot guarantee reading order for every document
A page has a column-spanning figure or headerSplit the page into upper and lower sections and sort each one separatelyA single three-part partition is not enough for these layouts
You tuned the rules on one pageRecord the rule version and page dimensions, then re-run on the full setThe values 80 and 300 come from one composite test page, not from real PDFs

This paper uses synthetic samples to demonstrate the processing method. Before processing important files, please retain the original copies and verify them against the boundaries and acceptance criteria outlined in this document.

Why does the order break?

The left column is read halfway through, and then the next sentence abruptly moves into the formula explanation in the right column. This is usually a reading-order problem, not a recognition problem. Every word may be recognised correctly, but the sequence is wrong.

For typical two-column papers, the reading order you want is:

  • Finish the left column, section by section.
  • Then move to the right column.

Interleaving the two columns line by line at the same height actually disrupts the paragraph structure.

Preserve coordinates and the source page first

Before you deal with the ordering issue, keep each text block's coordinates and source page. Do not rush to compress the whole page into one long string. Once regional information is lost, later translation steps receive context that is already misaligned. Switching to a different translation model may not fix this.

sort=True is worth trying, but it is not a layout interpreter

PyMuPDF offers several extraction formats, including text, words, and blocks, and you can enable sort on them. How it behaves depends on the output type and the library version. It is not a single, fixed typesetting algorithm, and it cannot restore the reading order of every document.

For rule-based pages, compare the results with sorting enabled and disabled. Pages with column-spanning headers, side notes, or footnotes need a closer look at how those elements sit in relation to each other.

PDFs may contain structural tags, but that does not mean the extraction interface you are using will produce the semantic paragraph tree you need. This guide does not implement general layout recognition. It shows only how to sort after region rules have been applied.

A synthetic test with five text blocks

The test page is set up as follows:

  • Page width: 600 points, with a column divider at 300.
  • Header area: the top 80 points, which holds the multi-column header. The main text area lies below it.
  • Input order: deliberately scrambled, so the second paragraph of the right column comes before the first paragraph of the left column.
  • Block format: each tuple holds the four coordinates of a rectangle plus its text. This is a simplified structure for illustration, not the complete return value of get_text("blocks").

The expected output is:

  1. The title
  2. The first paragraph of the left column
  3. The second paragraph of the left column
  4. The first paragraph of the right column
  5. The second paragraph of the right column

A block that spans the column boundary goes into an exception list. It should not be silently discarded or forced into the left column.

A small example you can run

The example uses only the Python standard library. When you connect it to PyMuPDF, extract the first five fields from each block result, and exclude non-text blocks first. This example opens no external files, needs no OCR, and does not infer column boundaries automatically.

def order_known_layout(blocks, split_x=300, title_bottom=80):
    groups = {"title": [], "left": [], "right": []}
    rejected = []
    for block in blocks:
        x0, y0, x1, y1, text = block
        if x1 <= x0 or y1 <= y0:
            rejected.append(block)
            continue
        if y1 <= title_bottom:
            region = "title"
        elif y0 < title_bottom:
            rejected.append(block)
            continue
        elif x1 <= split_x:
            region = "left"
        elif x0 >= split_x:
            region = "right"
        else:
            rejected.append(block)
            continue
        groups[region].append(block)
    ordered = []
    for region in ("title", "left", "right"):
        ordered.extend(sorted(groups[region], key=lambda b: (b[1], b[0])))
    return [b[4] for b in ordered], rejected

sample = [(330, 160, 550, 190, "R2"), (40, 100, 270, 130, "L1"),
          (40, 20, 550, 50, "TITLE"), (330, 100, 550, 130, "R1"),
          (40, 160, 270, 190, "L2")]
ordered, rejected = order_known_layout(sample)
assert ordered == ["TITLE", "L1", "L2", "R1", "R2"]
assert rejected == []
wide = (40, 220, 550, 250, "FULL WIDTH BODY")
assert order_known_layout(sample + [wide])[1] == [wide]
assert order_known_layout([]) == ([], [])
print("known-layout examples: 3 assertions passed")

The values 80 and 300 come from this composite test page. They are not thresholds to copy into every PDF. If the column widths change on the next page, reusing the previous page's parameters can produce output that looks normal but has the wrong content. Region rules should follow the page. At a minimum, record the rule version together with the page's original dimensions.

Acceptance testing should check more than error reports

A run that reports no errors does not mean the output is correct. Check each item below.

Check itemWhat you should see in this set of examplesWhat to do if it fails
Region orderAfter the title, the left column is complete, then the right columnCheck the partitioning rules. Do not rely on patches that swap strings.
Content conservationThe number of accepted blocks plus the number of rejected blocks equals the number of input blocksCheck for silent loss of blocks
Cross-boundary main textAppears in the rejection listAdd a section for spanning text, or decide it manually
Rotation and croppingInput blocks and partitions use the same coordinate systemStandardise the coordinates first, then run the containment check
Headers and footersSorted into their own category according to your business rulesDo not delete all bottom text without exceptions

Multi-column figures and special layouts

A paper may place a figure that spans several columns in the middle of a page, with the two-column layout restarting below it. In that case, divide the page into an upper and a lower section, then sort each one separately. The single three-part partition in this guide is not enough for that layout.

Vertical Chinese text, right-to-left writing, and complex marginal notes should not use this reading direction.

Using this with OmniDoc's translation workflow

A custom script is valuable because it lets you state your acceptance criteria clearly. An off-the-shelf translation tool is valuable because it reduces the steps between your source file and the translated manuscript. You can use both.

OmniDoc translates PDF, Word, PowerPoint and Excel files: scanned pages are recognized first, table cells are translated one by one so tables keep their rows and columns, and a PDF comes back as both a bilingual and a translation-only file. Paid translation adds a glossary and context translation. Use the same checklist to review a translated paper. Focus on:

  • Whether the first sentence after a spanning title is matched correctly
  • Whether figure captions are integrated into the main text
  • Whether footnote citations stay consistent

This review checks the delivered output. It does not make claims about OmniDoc's internal algorithms. If the results fall short, keep the original page and the faulty sections. Then decide whether the problem lies in recognition, sorting, or translation before you correct it.

Start with one page, not the whole document

Begin with a representative two-column page. Annotate by hand how it should be read, then run your rules on it. Keep both the passing and the failing samples. After you adjust the rules, re-run them on the whole set. A rule is worth using in batch processing only if it keeps the results that were already correct and fixes the new problems.

For interface and extraction reference, see the PyMuPDF Official Text Extraction Guide. The example tests one known region order. It does not show that layout analysis works on every PDF.

🎯 Which approach fits you?

If you process rule-based pages

Compare sorted and unsorted output on each page, and keep the rule version with the page dimensions.

If your pages have spanning headers, side notes, or footnotes

Study how those elements relate spatially, and split the page into upper and lower sections where needed.

If you want to translate a paper

Run the same acceptance checklist on the translated output before you use it.

❓ FAQ

1. Does sort=True guarantee the correct reading order?

No. Its behaviour depends on the output type and the library version, and it cannot restore the reading order of every document. Compare its results with unsorted output on each page.

2. Should I reuse the 80-point header and 300-point column divider on every PDF?

No. Those values come from one composite test page. Set region rules for each page, and record the rule version with the page dimensions.

3. What should happen to a block that crosses the column boundary?

Put it in an exception list. Do not discard it or force it into one column.

4. Can I process a page with a figure spanning two columns in the same way?

Not with a single partition. Split the page into upper and lower sections and sort each one separately.

📝 Summary

Preserve each block's coordinates and source page before you sort, and treat sort as one tool, not a complete solution. Test your rules on one page, check the output against the acceptance list, and only then roll them out in batches.

Try it now: upload a document and get it translated with the layout intact

Updated 2026-11-29