home / skills / openclaw / skills / pymupdf-pdf-parser-clawdbot-skill

pymupdf-pdf-parser-clawdbot-skill skill

/skills/kesslerio/pymupdf-pdf-parser-clawdbot-skill

This skill parses PDFs locally with PyMuPDF for fast Markdown output, optionally producing JSON, images, and tables per document.

npx playbooks add skill openclaw/skills --skill pymupdf-pdf-parser-clawdbot-skill

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
1.4 KB
---
name: pymupdf-pdf
description: Fast local PDF parsing with PyMuPDF (fitz) for Markdown/JSON outputs and optional images/tables. Use when speed matters more than robustness, or as a fallback while heavier parsers are unavailable. Default to single-PDF parsing with per-document output folders.
---

# PyMuPDF PDF

## Overview
Parse PDFs locally using PyMuPDF for fast, lightweight extraction into Markdown by default, with optional JSON and image/table outputs in a per-document directory.

## Prereqs / when to read references
If you hit import errors (PyMuPDF not installed) or Nix `libstdc++` issues, read:
- `references/pymupdf-notes.md`

## Quick start (single PDF)
```bash
# Run from the skill directory
./scripts/pymupdf_parse.py /path/to/file.pdf \
  --format md \
  --outroot ./pymupdf-output
```

## Options
- `--format md|json|both` (default: `md`)
- `--images` to extract images
- `--tables` to extract a simple line-based table JSON (quick/rough)
- `--outroot DIR` to change output root
- `--lang` adds a language hint into JSON output metadata

## Output conventions
- Create `./pymupdf-output/<pdf-basename>/` by default.
- Markdown output: `output.md`
- JSON output: `output.json` (includes `lang`)
- Images: `images/` subdir
- Tables: `tables.json` (rough line-based)

## Notes
- PyMuPDF is fast but less robust on complex PDFs.
- For more robust parsing, use a heavy-duty OCR parser (e.g., MinerU) if installed.

Overview

This skill provides fast local PDF parsing using PyMuPDF (fitz), producing Markdown by default and optional JSON, images, and simple table outputs. It targets speed and lightweight extraction for single-PDF processing, writing outputs into a per-document folder structure. Use it as a quick extractor or as a fallback when heavier parsers are unavailable.

How this skill works

The parser opens a PDF with PyMuPDF and streams page content into a chosen output format: Markdown, JSON, or both. When requested, it also extracts embedded images and generates a rough, line-based JSON representation of tables. Each processed PDF gets its own output directory with standardized filenames for easy downstream consumption.

When to use it

  • You need fast, local PDF extraction with minimal dependencies.
  • You want Markdown or JSON output for downstream text processing or ingestion.
  • You need image extraction from PDFs without running a heavy OCR pipeline.
  • You want a quick fallback when more robust parsers or OCR tools are unavailable.
  • You are processing single PDFs and prefer per-document output folders.

Best practices

  • Prefer this skill for well-formed, text-forward PDFs; complex layouts may require a heavier parser.
  • Use the --format option to select md, json, or both depending on downstream needs.
  • Enable --images only when you need embedded images to avoid extra I/O and disk use.
  • Treat the tables.json output as a rough, line-based hint rather than a fully accurate table extraction.
  • Set --outroot to organize outputs into a consistent archive structure per document.

Example use cases

  • Quickly convert a research paper PDF into Markdown for note-taking or publishing.
  • Batch-extract text and images from reports for fast indexing into a local search service.
  • Fallback extraction when a heavyweight OCR parser is not installed or is too slow.
  • Produce JSON metadata and body for automated ingestion into a document database.
  • Create per-document export folders for archiving and downstream processing pipelines.

FAQ

What formats does the skill produce?

It outputs Markdown by default, with optional JSON or both. Images and a rough tables JSON can be produced as well.

When should I not use this parser?

Avoid it for scanned PDFs, highly complex layouts, or when you need guaranteed table/structure accuracy; use a heavy-duty OCR or layout-aware parser instead.