Skip to content
Agentmart
Submit a tool

pdf-to-md

Convert PDFs (lecture slides, scripts, books) into clean Markdown/text an agent can read and search, with automatic fallback to Tesseract OCR for scanned PDFs.

Skill by smlfg

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/smlfg-pdf-to-md

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Convert PDFs (lecture slides, scripts, books) into clean Markdown/text an agent can read and search, with automatic fallback to Tesseract OCR for scanned PDFs. Use when a PDF should become agent-readable, single or in bulk.

Use cases: documents, presentations, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/pdf-to-md

What's inside

Skill name
pdf-to-md
Description
Convert PDFs (lecture slides, scripts, books) into clean Markdown/text an agent can read and search, with automatic fallback to Tesseract OCR for scanned PDFs. Use when a PDF should become agent-readable, single or in bulk.
License
MIT
Instructions
81 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (2)

  • SKILL.md
  • clean_markdown.py · scripts/

SKILL.md (first lines)

# PDF to Markdown

Turns `.pdf` files into clean `.md` for agent-friendly reading and search. Helper: [`scripts/clean_markdown.py`](scripts/clean_markdown.py) (control chars, ligatures, NFKC normalisation, whitespace).

## Prerequisites (once)

```bash
sudo apt install poppler-utils tesseract-ocr tesseract-ocr-deu   # add the language packs you need
```

## Step 1: Does the PDF have a text layer?

```bash
pdftotext -layout input.pdf - 2>&1 | head -5
```

Text → step 2a. Empty or error → scanned PDF → step 2b.

If you only need some chapters, find page boundaries first (table of contents, `pdfinfo`, then `pdftotext -f <first> -l <last>`).

## Step 2a: Text PDF

```bash
pdftotext -layout input.pdf - | python3 scripts/clean_markdown.py > input.md
```

## Step 2b: Scanned PDF (OCR)

```bash
pdftoppm -r 300 input.pdf page -png
for png in page*.png; do tesseract "$png" "${png%.png}" -l deu+eng; done
cat page*.txt | python3 scripts/clean_markdown.py > input.md
rm page*.png page*.txt
```

For PDFs over ~50 MB, OCR in 10-page chunks to save memory.

## Bulk: a whole folder

```bash
for pdf in ./*.pdf; do
  pdftotext -layout "$pdf" - | python3 scripts/clean_markdown.py > "${pdf%.pdf}.md"
  echo "✓ ${pdf%.pdf}.md"
done
```

## Step 3: Check the output

`head -20 input.md; wc -l input.md`. Expect more than 10 lines, no control characters, no "Error" strings. Too little text from a text PDF → switch to OCR.

## Naming convention (suggested)

`{COURSE}_{TOPIC}_{YYYYMMDD}.md`, e.g. `ALGO_Complexity_20260413.md`.

## Limits

| Problem | Workaround |
|---|---|
| Math formulas | extracted as Unicode, not LaTeX; readable but imperfect |
| Scanned formulas | OCR is approximate |
| Encrypted PDFs | can't convert; report "PDF is encrypted" |
| Tables | come out as space-separated columns; still agent-readable |

## Troubleshooting

- `Unable to parse` → non-standard or encrypted PDF; try OCR.
- `tesseract: command not found` → install it.
- Gibberish → bad encoding; `clean_markdown.py` normalises and resolves ligatures.

## Example

```bash
pdftotext -layout lecture-05-pipelining.pdf - | python3 scripts/clean_markdown.py > lecture-05-pipelining.md
wc -l lecture-05-pipelining.md   # 812
```

## Use case

You have a semester's worth of slide PDFs and want a study agent to answer questions from them. Run this skill over the folder once; scanned handouts fall back to OCR automatically, and the agent now greps Markdown instead of choking on PDFs.

From smlfg/HAI-skills-registry, MIT.

More from smlfg/HAI-skills-registry

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 15, 2026 (13 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from smlfg

Cite this page

pdf-to-md skill. Agent Mart. https://agentmart.dev/skills/smlfg-pdf-to-md (last updated 2026-10-24)