DEV Community

Anclum
Anclum

Posted on Originally published at anclum.com

A 3-page PDF in, 1,977 bytes of Markdown out — tables intact?

Three commands, one number each

A three-page PDF with two tables went through markitdown on a Linux x86_64 machine on 2026-11-22. Three commands describe everything measured here: the install, the conversion, and one count. The count is what decides whether the tables lived:

pip install 'markitdown[all]'
markitdown report.pdf > report.md
grep -c "^| " report.md
Enter fullscreen mode Exit fullscreen mode

The third command printed 12, and the row with the totals landed on line 15. Those two numbers are the whole result, and the rest of this post is about what they do and do not tell you.

What got installed

pip install 'markitdown[all]' finished in 22 seconds and installed 44 packages. What arrived was markitdown-0.1.9; markitdown --version printed markitdown 0.1.9, which is how you find out what is actually on the machine rather than what the browser tab promised.

44 packages for a command that reads a document and prints Markdown is worth a pause. The [all] extra is what does it: it pulls the optional parsers for the other formats the tool can read. If your input is a single format, most of those packages are weight you will never touch. I installed the full extra anyway, because the question was whether the default path keeps a table, not what the smallest install looks like.

The conversion

markitdown report.pdf > report.md
Enter fullscreen mode Exit fullscreen mode

Exit code 0, duration 1 second. The output was 1,977 bytes:

wc -c report.md
Enter fullscreen mode Exit fullscreen mode

1,977 bytes for three pages of text and two tables is small. Small enough that the usual reaction is "something got dropped". Keep that reaction until you have opened the file, because a converter that fails quietly and a converter that writes compact Markdown look identical from a byte count. The byte count tells you the output is suspiciously small or suspiciously large. It does not tell you the tables are inside.

This is also where people stop. The file exists, it is not empty, the command exited 0 — all true, and none of it answers the question that sent you to a converter to begin with.

Did the table survive

Two checks, both from the shell, both repeatable:

grep -c "^| " report.md
Enter fullscreen mode Exit fullscreen mode

That printed 12: twelve lines in the output begin with a pipe and a space. Both tables came through as pipe tables; those twelve lines are where they live.

grep -n "| Total" report.md
Enter fullscreen mode Exit fullscreen mode

That printed:

15:| Total | 4,810,000 | 4,280,000 | +12.4% |
Enter fullscreen mode Exit fullscreen mode

The totals row is there with its three numbers and its percentage, on line 15. Run the same command on your PDF and expect a different line number: it depends on how much text sits above the table, how the pages before it came out, and whether the source had a title block. 15 is a fact about this file, not a property of the tool. What generalizes is the shape — a pipe row whose cells appear in the same order they had in the PDF.

One artifact worth knowing: the footer

The document carried a footer on every page, Northwind Logistics - Q3 2026 operating review - page N of 3. In the Markdown it appears three times, once per page.

That is not a converter bug. The PDF contains that text three times; a converter that preserves text preserves page furniture too. If the Markdown is going into a model, that is three lines of tokens that say nothing about the content. If you are chunking it, it is a string that repeats across three chunks and makes them look more alike than they are. Strip it before you embed, not after.

A byte count will never show you this, and a glance at the top of the page will not either — the second occurrence is on page two.

What was not tested

Four boundaries, in the order they are likely to matter:

  1. Scanned documents. This PDF had a text layer. A scan does not, and what this converter does with a scan was not tested. The twelve pipe lines are not evidence about scans.
  2. 1,977 bytes belongs to this file. A longer PDF, one with images, or one with a different table style will produce a different number. Use it as a baseline to compare your own runs, not as a target.
  3. One tool, one machine. Linux x86_64, pip, version 0.1.9. macOS and Windows were not run, and no second converter was compared against this one, so nothing here is a ranking.
  4. Table fidelity is not layout fidelity. Twelve pipe lines say the rows and cells are present and in order. They do not say that merged cells, alignment or column widths survived; Markdown has no way to express most of that.

The trap that is not about the tool

While assembling this, a separate failure showed up: an earlier draft named pypdf and pdfplumber as the tools behind these steps. Neither of those is the tool that ran them, and neither name matched anything in the set of tools these steps are validated against — so the write-up described a workflow that could not be followed, while reading plausibly enough to pass a quick look.

The lesson is not "use markitdown". It is that the tool you name has to be the tool that ran. Check it the boring way — markitdown --version prints the version present on the machine, and a command that answers command not found costs you ten seconds, while a paragraph about a tool you never installed costs a reader their afternoon.

That is why every number above comes with the command that prints it. "The tables came through" without a grep -c behind it is exactly as checkable as that pypdf draft: not at all.

Checking your own run

Five commands, each answering one question:

markitdown --version            # which tool is actually installed
markitdown your.pdf > your.md   # exit code: did it run, or fail on the way in
wc -c your.md                   # how large the output is
grep -c "^| " your.md           # how many pipe rows came through
grep -n "| Total" your.md       # where the row you care about landed
Enter fullscreen mode Exit fullscreen mode

The last two answer the table question. If grep -c returns 0 on a PDF that visibly has tables, the rows were not written as pipe tables — the pages may have had no text layer, or the table may have come out as plain lines. Either way you learned it before the model did.

The same walkthrough, with the steps in order and the tool page, is here: https://anclum.com/en/scene/content/

Everything above was measured on Linux x86_64 on 2026-11-22. The install took 22 seconds on that machine and that network. The conversion took 1 second on a three-page file. Neither is a promise about your machine, your PDF, or a scanned page.

— David, maintainer of Anclum

Top comments (1)

Collapse
 
kamalmosadegh profile image
Kamal Mosadegh •

Good discipline — the byte count is a suspicion, not a verdict, and the two shell checks are the right shape. One addition that would make the verdict airtight: the pipe count verifies the table's shape, not its content. A table can survive as pipes with a wrong number in it. The check that closes that gap is arithmetic on the totals row itself: 4,810,000 / 4,280,000 − 1 = 12.38%, which matches the +12.4% on line 15 — so this table didn't just survive, it survived correctly. Worth doing on every table you care about, because a converter that misreads one cell still prints twelve pipe rows.

Two more things from running the same three commands on harder files. First, the footer: it appears three times because the PDF contains it three times, and if that Markdown goes into an index, those three identical lines make three chunks look more alike than they are — strip page furniture before embedding, not after. Second, run the same commands on a scanned page of the same report and everything still looks fine — exit 0, file exists — except the file is 0 bytes. Byte count can't tell "compact Markdown" from "silently empty". The check I use is per-page, not per-file: count characters per page, and any page under ~50 chars from the text layer gets routed to OCR, with the output saying which route produced it. I benchmarked exactly that failure on MarkItDown 0.1.9 vs a tool that refuses to fail silently — dev.to/kamalmosadegh/markitdown-re... — and the scanned case is where the two diverge: exit 0, 0 chars, no warning, versus OCR plus a declared route. My tool for the per-page approach is github.com/kamalmosadegh/pdf-slice