Batch Convert PDF to Markdown: The Pipeline That Doesn't Need Babysitting
Point a local CLI converter at the folder and let the loop run — then sort what comes out into pass / fail / manual with two automatic checks: empty output and heading density. Roughly 80–90% of a clean digital-PDF batch passes untouched; the rest needs a human. Quality comes from the triage, not from picking a fancier converter.
Day 6 of our 28-day series. The single-file workflow lives here; today we scale it.
The three-step batch pipeline
Step 1: Pre-sort the folder (5 minutes, saves hours later)
Open a handful of PDFs and split the folder into two groups:
- Text-layer PDFs — text selects cleanly. Safe to batch. Usually the majority.
- Scan/image PDFs — nothing selects. Pull them out; they need OCR (that's the subject of an upcoming day, don't run them through a text extractor).
A quick heuristic without opening anything: scanned PDFs are usually 10–50× larger than the same page count as a text PDF. Files that look suspiciously heavy go in the manual pile.
Step 2: The conversion loop
Linux/macOS, one line:
for f in *.pdf; do pymupdf4llm "$f" > "md/$f.md"; done
(swap in marker for better structure recovery on layout-heavy documents). On Windows, the same loop in PowerShell, or run everything inside WSL. Run it overnight if the folder is large — a few hundred files typically takes minutes to low tens of minutes.
Step 3: Automatic triage — the part everyone skips
Don't eyeball 200 files. Check two signals with a script or a text editor's file list:
- Empty or tiny output (a .md under ~200 characters from a multi-page PDF) → the file had no usable text layer. Reclassify it as scan/manual.
- Heading density (a long output with zero
#characters) → headings didn't survive; most of the content may still be fine, but structure repair is needed.
Everything else passes a spot check of one random page per document, not every page. That's the 90/10 rule of batch conversion: automated checks catch 90% of failures, and one page of human review catches most of the rest.
What batch conversion costs you (be honest here)
Batch quality is lower than single-file quality, deterministically, for these file types:
| File type | Batch verdict | Why |
|---|---|---|
| Native digital PDF (born-digital reports, papers) | Batch it | Clean text layer, uniform layout |
| Scanned documents | Pull out, OCR later | Text extraction returns nothing or garbage |
| Forms & certificates | Manual | Layout is positional, not linear — conversion scrambles reading order |
| Table-heavy spreadsheets-as-PDF | Half-batch, check every table | Tables are the #1 breakage (see the table guide) |
Online batch tools vs your own loop
Online converters (CloudConvert, iLovePDF, and similar) do offer multi-file upload, and for a one-time 10-file job they're fine. Three reasons to build your own loop instead for anything recurring:
- Rate limits and file caps on free tiers make 100+ files a paid job by volume.
- Confidential content — every file in a batch leaves your machine; with a local loop, nothing does.
- Repeatability — next month's new batch runs with the zero additional setup once the loop exists.
Automation proper: make it run itself
Once the loop works, wire it to trigger automatically: a watched folder (a cron job / scheduled task that checks for new .pdf files every hour), or a CI step if your PDFs arrive via a repository or API. The end state: PDFs drop into a folder, Markdown appears in another folder, a summary of failures lands in your inbox or a log file. That's the difference between "batch converting" and "having a conversion pipeline."
Quick FAQ
How many PDFs is "batch" worth setting up?
Around 10. Below that, single-file tools are faster than configuring a loop. Above 10, the loop pays back immediately.
Why do some files in the same batch fail while others succeed?
It's almost always the text layer, not the converter. Same tool, different file history (born-digital vs scanned vs OCR'd-once-by-previous-owner). Sort before converting.
Can I batch convert to other formats (DOCX, HTML) with the same approach?
Yes — only the output extension changes. The pre-sort and triage logic is format-independent.
Is there a way to preserve per-file metadata (titles, authors) during batch conversion?
CLI tools read the PDF metadata and can carry it into a YAML front-matter block. Online tools usually drop it.
Tomorrow in the series: OCR-first workflows — handling scanned PDFs, the deliberate exception we pulled out of today's batch. Bookmark pdf2mdtool.com and follow along.