Skip to content
Skills Library
Documents & office · Conversion & formats

pdf-ocr

/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.

Licence
MIT
Last repository change
18.05.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
1
HTML comments
1
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 18.05.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

Scripts: scripts/pdf_ocr.py

What it does and when to use it

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.

Arguments

/pdf-ocr <path-to-pdf>
Original author description

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.

How it works

  1. Workflow
  2. Key Technical Details
Original SKILL.md headings · 75 lines, 499 words
SKILL.md preview
---
name: pdf-ocr
description: "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."
allowed-tools: Bash, Read, Write, AskUserQuestion
argument-hint: <path-to-pdf>
---

# 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-page
Files in this package (2)
  • SKILL.md 3 KB
  • scripts/pdf_ocr.py 5 KB

Versions

RepositoryScoreLicence
This page · alteredcraft/claude-code-plugins100MIT
TerminalSkills/skills100Apache-2.0

Database snapshot: 13.11.2026 · package version 34db73bc2cdf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100pdf-extractor
    This skill should be used when the user asks to "extract text from PDF", "convert PDF to text", "parse PDF", "read PDF contents", "extract data from documents", "batch PDF extraction", "PDF to markdown", "OCR PDF", "get text from PDF files", "I have a PDF", "can you read this…
  • 100document-processing
    This skill should be used when the user says \"process documents\", \"extract text from PDF\", \"OCR this document\", \"convert PDF to markdown\", \"extract emails from documents\", \"parse document\", \"document conversion\", \"batch OCR\", \"extract structured data from PDF\",…
  • 100ocr-tool
    Extract raw text from PDF files with OCR, including full-document extraction, selected page ranges, and reuse of cached pages. Use when a user asks to OCR a PDF, extract text from a scanned PDF, or read selected PDF pages.
  • 100pdf-convert
    [Document Processing] Use when converting between PDF and Markdown: text PDFs to Markdown (scanned PDFs are reported, not OCR''d), Markdown to styled PDF. --to={markdown|pdf}.
  • 100pdf-convert
    [Document Processing] Use when converting between PDF and Markdown: text PDFs to Markdown (scanned PDFs are reported, not OCR''d), Markdown to styled PDF. --to={markdown|pdf}.
  • 100glmocr
    Extract text from images using GLM-OCR API. Supports images and PDFs with high accuracy OCR, table recognition, formula extraction, and handwriting recognition. Use this skill whenever the user wants to extract text from images, perform OCR on pictures, scan documents, convert…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.