pdf-ocr
Parse PDF files to markdown using GLM-OCR via Ollama locally. Converts each page to an image, runs OCR, and outputs clean markdown. Use when the user wants to extract text from a PDF.
Best use case
pdf-ocr is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Parse PDF files to markdown using GLM-OCR via Ollama locally. Converts each page to an image, runs OCR, and outputs clean markdown. Use when the user wants to extract text from a PDF.
Teams using pdf-ocr should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pdf-ocr/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pdf-ocr Compares
| Feature / Agent | pdf-ocr | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Parse PDF files to markdown using GLM-OCR via Ollama locally. Converts each page to an image, runs OCR, and outputs clean markdown. Use when the user wants to extract text from a PDF.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# PDF OCR via GLM-OCR + Ollama
Convert PDF files to markdown using local OCR. Each page is rendered to an image, processed through GLM-OCR running on Ollama, and the recognized text is assembled into a single markdown file.
## Workflow
### Phase 1: Dependency Check
Run these checks and report a status table. If any required dependency is missing, use AskUserQuestion to offer installation.
| Dependency | Check | Install |
|-----------|-------|---------|
| Ollama running | `curl -sf http://127.0.0.1:11434/api/tags > /dev/null` | **Cannot auto-start.** Tell user to start Ollama and stop. |
| `glm-ocr` model | Check that Ollama tags response contains `glm-ocr` | `ollama pull glm-ocr` |
| `pdftoppm` | `which pdftoppm` | `brew install poppler` |
| `pdfinfo` | `which pdfinfo` | Comes with poppler |
| `sips` | `which sips` | Built-in on macOS. Warn if missing. |
Check all five in a single Bash call:
```bash
echo "=== Ollama ===" && curl -sf http://127.0.0.1:11434/api/tags && echo "" && echo "=== pdftoppm ===" && which pdftoppm && echo "=== pdfinfo ===" && which pdfinfo && echo "=== sips ===" && which sips
```
Parse the output:
- If curl fails: Ollama is not running. **Stop and tell user to start Ollama.**
- If `glm-ocr` is not in the tags list: ask user if they want to pull it (`ollama pull glm-ocr`).
- If `pdftoppm` or `pdfinfo` missing: ask user if they want to install poppler (`brew install poppler`).
- If `sips` missing: warn user (built-in on macOS, no auto-install).
If all checks pass, proceed to Phase 2.
### Phase 2: Execute OCR
1. Validate the argument is a path to an existing `.pdf` file. If no argument was provided, print usage and stop:
> Usage: `/pdf-ocr <path-to-pdf>`
> Converts a PDF to markdown using local GLM-OCR via Ollama.
2. Determine the output path: same directory as the PDF, same base name with `.md` extension.
3. Get the page count to decide foreground vs background execution:
```bash
pdfinfo "<pdf_path>" | grep "^Pages:"
```
4. Run the OCR script:
```bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/pdf-ocr/scripts/pdf_ocr.py "<input.pdf>" "<output.md>"
```
- **10 pages or fewer**: Run in foreground (timeout 600000ms / 10 min).
- **More than 10 pages**: Run in background so the user can continue working. Use `timeout: 600000`.
### Phase 3: Report Results
After the script completes:
1. Read the first 50 lines of the output `.md` file to show a preview.
2. Report:
- Page count processed
- Output file path
- Total character count (from the script's stdout)
- Approximate time taken (from the script's stdout)
## Key Technical Details
- Images are rendered at 72 DPI then resized to max 1024px (the sweet spot for GLM-OCR accuracy)
- The prompt must be exactly `"Text Recognition:"` — other prompts degrade quality
- Each page gets a `<!-- Page N -->` marker with `---` separators between pages
- The script uses only Python 3 stdlib (no pip dependencies)
- Temp files are created in `/tmp/claude/ocr_pages` and cleaned up per-pageRelated Skills
obsidian-cli
Use the Obsidian CLI to manage knowledge in an Obsidian vault — daily notes, search, tasks, tags, link graph analysis, properties, templates, and file operations. This skill should be used when the user asks to interact with their Obsidian vault, manage daily notes, search notes, manage tasks, explore tags or backlinks, set properties, use templates, or perform vault maintenance.
qr-code
Generate QR codes from URLs, text, or other data and save them as SVG, PNG, EPS, or PDF files. This skill should be used when the user asks to create, generate, or make a QR code for any content such as website URLs, text strings, WiFi credentials, contact info, or other data. Triggers include mentions of 'QR code', 'QR', 'barcode for a link', or requests to make a scannable code. Supports customization of colors, size, error correction level, and output format.
powerpoint
Create professional PowerPoint presentations. Use when asked to "create a PowerPoint", "make a presentation", "build slides", or generate pptx files.
ralph-method
Set up a Ralph Wiggum task - runs Phase 1 (requirements interview) and Phase 2 (implementation planning), then stops with instructions to run the building loop. Creates namespaced specs in specs/[task-name]/.
journal
An agent to journal developer activity over a specified time period.
walkthrough-creator
Create and maintain the walkthrough artifact during implementation
task-list-creator
Create or update the task list artifact from gathered requirements
implementation-plan-creator
Create the implementation plan artifact from an approved task list
adr-manager
Add Architecture Decision Record (ADR) entries to an ADR file. This skill should be used when recording significant architectural decisions during development. It handles formatting and appending entries using Michael Nygard's ADR template.
essay-draft-from-research
Produces a long-form essay draft grounded in a user-supplied directory of research documents via an interview workflow. Use whenever the user wants to "draft an essay from my research", "write an essay from these notes", "turn this research directory into an essay", "I've been collecting notes on X, help me draft an essay", or "draft a long-form piece using these sources". Do NOT use for: one-shot summarization of a single document, short notes or tweets under ~600 words, pure research-findings synthesis with no drafting, or essay drafting when there is no research corpus to ground in.
feature-spec-creator
Generates a feature spec for an existing codebase via an interview workflow. Use when the user wants to write, draft, or scope a feature spec — phrases like "write a feature spec", "spec out this feature", "draft a spec for X", "I want to add X to this codebase", "let's plan a new feature", or "scope out this feature". Do NOT use for bug fixes, pure refactors with no behavior change, or greenfield projects with no existing code.
create-skill
Creates a new Claude Code skill that follows the Anchored Interview pattern — ground in a CORPUS, run an interview anchored by that grounding, then produce a single ARTIFACT. Use whenever the user wants to scaffold, generate, or design an interview-style skill — phrases like "make me an anchored interview skill", "create a skill that interviews me about X and produces Y", "scaffold a skill that reads my <corpus> and writes a <artifact>", "I want a skill for spec/draft/plan/findings creation via interview", or any request to build a skill that has the ground-then-ask-then-act shape. Do NOT use for: running an anchored interview on a specific task (this skill *creates* such skills, it doesn't perform them — for that, use or create the appropriate task-specific skill); editing an existing SKILL.md; one-shot transformations with no judgment calls; or skills where there is no corpus to ground in.