Tables, Formulas, and Multi-Column Layouts: Why This PDF Content Breaks Every Converter

Two-column academic papers, math textbook formulas, technical manual code blocks — this content almost always breaks when converting PDF to EPUB. Here's the specific challenge of each, and how AI solves it.

| PDF2EPUB Team

If the PDF you’re converting is a plain-text novel, most converters will give you a passable result.

But if your PDF contains any of the following —

  • The two-column layout of an academic paper
  • The formulas of a math textbook
  • The code blocks of a technical manual
  • The tables of a report
  • The mixed text-and-image layout of a magazine or picture book

— then congratulations, you’ve stepped on the biggest minefield in PDF-to-EPUB conversion.

These content types drop conversion quality from “good enough” straight to “completely unusable.” Not because the converters are bad, but because each kind of complex layout pushes against the fundamental limits of the PDF format.

Let’s break them down one by one.

Challenge 1: Multi-Column Layouts

How bad is it?

A real test from a MobileRead forum user: a 129-page multi-column PDF lost its multi-column format entirely after conversion — all text merged into a single column, and the reading order became meaningless.

This isn’t a fluke — multi-column layout is the single most common case where traditional converters fail.

Why can’t traditional methods handle it?

Traditional converters extract text blocks by coordinate. Suppose you have a two-column page:

Column 1, line 1 |  Column 2, line 1
Column 1, line 2 |  Column 2, line 2
Column 1, line 3 |  Column 2, line 3

What the converter sees is: “There’s text at coordinate (72, 720), and more text at coordinate (306, 720).” It has to decide: read (72, 720) first, or (306, 720) first?

If it sorts by Y coordinate (top to bottom), it reads column 1 line 1, then column 2 line 1 — but those two lines aren’t continuous content at all.

It gets worse: some pages are two-column in the top half and single-column in the bottom (like a references section). Some pages have a longer first column than second. Some have a heading that spans both columns.

Each variant needs an extra rule to handle, and the rules can contradict each other.

How does AI handle it?

When the Gemini model “looks” at the page, it does so the way a person would — it recognizes at a glance that this is a two-column layout, then reads it in the correct order: finish the left column, then read the right.

It even handles these edge cases:

  • Two columns on top, single column on the bottom → correctly identifies the dividing line
  • A spanning heading → recognized as a heading, placed before both columns
  • Unequal column lengths → won’t splice the blank space of the short column onto the tail of the long column

This requires no rules at all — the AI learned what a two-column layout “looks like” and how it should be read from a vast range of documents.

Challenge 2: Mathematical Formulas

How bad is it?

A simple quadratic formula, $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$, may be stored in a PDF as dozens of separate characters, each with its own coordinate, size, and font.

What a traditional converter extracts might look like:

x = −b ± b2 − 4ac 2a

The fraction bar is gone, the square root is gone, and the positional relationships of the superscripts and subscripts are gone. This “formula” is completely unreadable.

Why is it so hard?

A math formula in a PDF isn’t stored as a “formula” — it’s a pile of precisely positioned characters and lines. The fraction bar is a horizontal line segment, the radical is a curve, the superscript is a small character at a higher Y coordinate.

A traditional converter doesn’t know the semantic relationships between these elements. It only sees:

  • Character “x” at coordinate (100, 500)
  • Character ”=” at coordinate (115, 500)
  • Character ”−” at coordinate (130, 500)
  • Character “b” at coordinate (140, 500)
  • A horizontal line at coordinate (155, 488) (this is the fraction bar)
  • Character “2” at coordinate (135, 495) (this is a superscript)

Reconstructing the mathematical meaning of the formula from this raw data requires extremely complex heuristics — and every math typesetting system (TeX, Word’s Equation Editor, MathType) produces a different PDF structure.

How does AI handle it?

When the Gemini model sees the formula image, it directly understands that it’s a math formula and outputs a standard LaTeX representation:

$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$

This LaTeX renders correctly in the EPUB. The AI doesn’t need to parse character coordinates inside the PDF — it visually recognizes what the formula is, the same way you’d read a math worksheet.

Our pipeline adds one extra step here: common Unicode math symbols in PDFs (like x², ∑, ∫) are normalized into LaTeX format to ensure consistent rendering across different reader apps.

Challenge 3: Tables

How bad is it?

Tables in a PDF often turn into this after conversion:

Product Price Stock
Laptop 6999 In stock Smartphone 3999 Out of stock Headphones 299 In stock

The table structure is completely lost, and the row-and-column correspondence is gone. Worse still, the table can get mixed into the body text with no way to tell them apart.

Why is it so hard?

A table in a PDF isn’t an HTML <table> tag — it’s just text and lines drawn at specific positions.

Inside a PDF, a table looks roughly like this:

% draw table lines
0 0 500 200 re S      % draw a rectangular border
0 100 500 0 m l S     % draw a horizontal line
200 0 0 200 m l S     % draw a vertical line

% place text
BT 10 180 Td (Product) Tj ET
BT 210 180 Td (Price) Tj ET
BT 10 80 Td (Laptop) Tj ET
BT 210 80 Td (6999) Tj ET

A traditional converter has to:

  1. Identify which lines form the table borders
  2. Infer the row-and-column structure from the line intersections
  3. Assign text to the corresponding cells
  4. Handle special cases like merged cells and nested tables

If the table has no explicit border lines (many modern designs distinguish rows with alternating colors or spacing), traditional methods are almost entirely unable to recognize it.

How does AI handle it?

When the Gemini vision model sees a table, it directly understands the row-and-column structure and outputs a Markdown table:

| Product | Price | Stock |
|---------|-------|-------|
| Laptop | 6999 | In stock |
| Smartphone | 3999 | Out of stock |
| Headphones | 299 | In stock |

Even for borderless tables or tables with merged cells, the AI can identify the structure through visual alignment — because it’s understanding “the spatial relationships between this data,” not hunting for lines.

Challenge 4: Code Blocks

How bad is it?

Code blocks in technical books and manuals, after traditional conversion, usually:

  • Lose their indentation (Python’s indentation is gone, so the logic falls apart)
  • Get treated as ordinary paragraph text (mixed into the surrounding context)
  • Lose monospace font information (all text becomes a single font)

How does AI handle it?

Gemini can recognize a code block — through visual cues like monospace font, background color, and line numbers — and mark it as a code block in the output:

```python
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
```

Indentation, blank lines, and syntactic structure are all preserved.

Challenge 5: Mixed Text and Images

How bad is it?

When text wraps around an image, a traditional converter can’t tell “this text is an image caption” from “this text is body copy that just got pushed to the right by the image.” The result: the image either disappears or ends up in completely the wrong place.

How does AI handle it?

In our pipeline, Gemini processes each image on a page at three levels:

  1. Detect image position: outputs the image’s normalized coordinates (bounding box) on the page
  2. Determine image type: is it a content-relevant illustration, or a decorative element (logo, watermark)?
  3. Generate an image description: produces a context-relevant description in the document’s original language

Meanwhile, the high-resolution original image is extracted from the source PDF, embedded into the EPUB, and correctly associated with its caption.

Real-World Conversion Results

Complex layout typeTypical traditional resultpdf2epub.ai’s approach
Two-column academic paperColumns mashed into one, reading order scrambledCorrectly identifies columns, outputs in correct order
Math formulasTurns into meaningless character fragmentsConverted to renderable LaTeX
Data tablesRow/column structure lostConverted to semantic Markdown tables
Code blocksIndentation lost, merged into bodyFormat preserved, marked as code block
Mixed text and imagesImages lost or misplacedOriginal extracted + description generated + correctly positioned
FootnotesMerged into bodyRecognized as footnotes, correctly annotated
WatermarksLeft behind in the textAutomatically detected and removed

Which PDFs Benefit Most From AI Conversion?

Based on the documents we’ve processed, the types that gain the most from AI conversion are:

  1. Academic papers and journals (two columns + formulas + footnotes + references)
  2. STEM textbooks (formulas + charts + code + exercises)
  3. Technical manuals and API docs (code blocks + tables + hierarchical structure)
  4. Scanned old books and materials (need OCR + layout reconstruction)
  5. Business reports (tables + charts + mixed layouts)

For plain-text novels or simply-formatted documents, traditional tools are already good enough — no need to pay for AI.


Try your most complex PDF: pdf2epub.ai gives you free credits on signup. You can preview a few pages first — see how the AI handles your tables, formulas, and multi-column layouts.


Ready to Convert Your PDF?

Try PDF2EPUB.ai free - AI-powered PDF to EPUB conversion with OCR, formula preservation, and beautiful formatting.

Try PDF2EPUB Free

Free PDF & EPUB Tools

No sign-up, no upload — everything runs in your browser.

Related Articles