How to Convert PDF Tables to Markdown: Handling Merged Cells & Complex Layouts

12 de feb. de 2026

PDFs are great for printing but terrible for data extraction. If you have ever tried to copy a table from a financial report or academic paper into Obsidian or Notion, you know the frustration: misalignment, broken rows, and "text soup" where columns used to be.

The problem gets worse with complex documents. Merged cells, nested headers, and multi-column layouts break most traditional conversion tools.

Here is why that happens and how AI-driven tools fix it.


Why Standard Converters Fail

PDFs are visual documents, not structured data. They contain instructions on where to draw characters (e.g., "draw 'A' at x:100, y:200"), but they don't know that those characters belong to a specific table cell.

Traditional tools like pdftotext guess the layout by looking for whitespace. This guessing game fails in three common scenarios:

1. Merged Cells

When a table header spans multiple columns (like "Yearly Revenue" over Q1, Q2, Q3), simple scripts see one long line of text. They fail to reserve space for the columns below, shifting the entire dataset and ruining the alignment.

2. Multi-Column Text

In academic papers, text flows down the left column and then continues at the top of the right. Basic converters often read straight across the page, mixing sentences from both columns into a nonsensical paragraph.

3. Math Formulas

Copy-pasting an equation usually results in broken symbols (∑ becomes ?) or missing formatting (E = mc 2 instead of $E = mc^2$).


Visualizing the Problem: Before vs. After

To show you exactly what we mean, let's look at a simple financial table with a merged header.

The Original PDF Table:

Q1Q2
Revenue$10M$12M
Net Profit$2M$3M

What Standard Tools Output (The "Text Soup"):

Revenue $10M $12M
Net Profit $2M $3M

Note: The columns are gone. If you paste this into Excel, everything lands in Column A.

What AI Layout Analysis Outputs:

|          | Q1   | Q2   |
| :------- | :--- | :--- |
| Revenue  | $10M | $12M |
| Net Profit | $2M  | $3M  |

Note: The structure is preserved. You can paste this directly into Notion or GitHub.


The AI Approach: Visual Layout Analysis

Modern tools, like PDF to MD, use computer vision to "see" the page layout. Instead of just scraping text, they analyze the visual grid.

This allows the engine to:

  1. Recognize Structure: Identify that a block of text is a table, not just a list.
  2. Handle Spans: Detect when a cell spans multiple rows or columns and format it accordingly in Markdown.
  3. Parse Math: Recognize equations and convert them into standard LaTeX syntax.

Comparison: Regex vs. AI

FeatureLegacy Regex / OCRAI Layout Analysis
Merged CellsSplits them into empty columns.Identifies colspan/rowspan correctly.
Multi-ColumnBreaks reading order (reads left-to-right).Follows the correct column flow.
FormulasGarbled text.Standard LaTeX ($x^2$).
ImagesGenerally ignored.Extracted and linked.

| Images | Generally ignored. | Extracted and linked. |


3 Real-World Use Cases

Who actually needs this level of precision?

1. Financial Analysts (Balance Sheets)

Quarterly reports are full of tables where the header "Year Ended Dec 31" spans multiple columns.

  • The Pain: Extracting this data manually means re-typing numbers to ensure they line up with the correct year.
  • The Fix: AI Layout Analysis detects the colspan header and aligns the 2024 and 2025 data points correctly underneath it.

2. Academic Researchers (Two-Column Papers)

Most scientific papers use a two-column layout to save space.

  • The Pain: Selecting text often highlights line 1 of column A, then line 1 of column B, merging them into a gibberish sentence.
  • The Fix: Our tool identifies the "gutter" (the white space between columns) and processes the text in the correct reading order (down left, then down right).

3. Developers (Legacy Documentation)

Migrating old manuals to a new site (like Docusaurus or GitBook)?

  • The Pain: Old manuals are often scanned PDFs with complex tables listing API parameters.
  • The Fix: The OCR engine reads the scan, and the layout engine reconstructs the parameter tables, saving days of manual data entry.

How to Convert Complex PDFs

We built PDF to MD to solve these specific edge cases. Here is the workflow:

Step 1: Upload

Drag and drop your PDF into the workspace.

  • Security: We process files instantly and delete them immediately after conversion. We do not store your data.

Step 2: Instant Preview

You will see a side-by-side view: original PDF on the left, generated Markdown on the right. Scroll through the PDF, and the Markdown view follows, so you can spot-check complex tables immediately.

Step 3: Check the Details

  • Tables: Verify that headers align and merged cells are intact.
  • Math: Ensure equations are wrapped in $$ or $ for LaTeX rendering.

Step 4: Export

  • Copy Markdown: Paste directly into your notes app.
  • Download .zip: Best if your document has images. You get the .md file plus a folder of high-resolution charts and figures.

Best Practices for Post-Conversion

Even with AI, it is always good to verify your data. Here is a quick checklist for after you convert:

1. The "Spot Check"

Scroll to the most complex table in your document. If the AI handled that correctly (headers aligned, data in right cells), the rest of the document is likely fine.

2. VS Code & Prettier

If you are a developer, open the .md file in VS Code. Use a formatter like Prettier to standardize the spacing of your tables. It makes the raw Markdown much easier to read and edit.

3. Image Paths

If you move your Markdown file to a new folder, remember to move the assets folder with it. Markdown links are relative (./assets/image.png), so they break if the file and images get separated.


Common Questions

Can I convert scanned documents? Yes. The tool includes OCR. If you upload a scan of an old book or receipt, it reads the text and reconstructs the layout just like a digital PDF.

Does this work with Notion and Obsidian? Yes. We output standard GitHub Flavored Markdown (GFM). Tables, images, and math will render correctly in Notion, Obsidian, Logseq, and GitHub.

How accurate is it? For complex tables, it is significantly faster than manual entry. While ambiguous layouts can sometimes be tricky, most users find it handles merged cells and nested data far better than copy-pasting.


Get Started

Stop manually fixing line breaks and table borders. Upload your document to PDF to MD and get a clean, usable Markdown file in seconds.