โ† All skills
Tencent SkillHub ยท Developer Tools

Extract PDF Text

Extract text from PDF files using PyMuPDF. Parse tables, forms, and complex layouts. Supports OCR for scanned documents.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Extract text from PDF files using PyMuPDF. Parse tables, forms, and complex layouts. Supports OCR for scanned documents.

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md, examples.md, ocr.md, troubleshooting.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.2

Documentation

ClawHub primary doc Primary doc: SKILL.md 15 sections Open source page

When to Use

Agent needs to extract text from PDFs. Use PyMuPDF (fitz) for fast local extraction. Works with text-based documents, scanned pages with OCR, forms, and complex layouts.

Quick Reference

TopicFileCode examplesexamples.mdOCR setupocr.mdTroubleshootingtroubleshooting.md

1. Install PyMuPDF First

pip install PyMuPDF Import as fitz (historical name): import fitz # PyMuPDF

2. Basic Text Extraction

import fitz doc = fitz.open("document.pdf") text = "" for page in doc: text += page.get_text() doc.close()

3. Pick the Right Method

PDF TypeMethodText-basedpage.get_text() โ€” fast, accurateScannedOCR with pytesseract โ€” slowerMixedCheck each page, use OCR when needed

4. Check for Text Before OCR

def needs_ocr(page): text = page.get_text().strip() return len(text) < 50 # Likely scanned if very little text

5. Handle Errors Gracefully

try: doc = fitz.open(path) except fitz.FileDataError: print("Invalid or corrupted PDF") except fitz.PasswordError: doc = fitz.open(path, password="secret")

Extraction Traps

TrapWhat HappensFixOCR on text PDFSlow + worse accuracyCheck get_text() firstForget to close docMemory leakUse with or doc.close()Assume page orderWrong reading flowUse sort=True in get_text()Ignore encodingGarbled charactersPyMuPDF handles UTF-8

Scope

This skill provides instructions for using PyMuPDF to extract PDF text. This skill ONLY: Gives code examples for PyMuPDF Explains OCR setup when needed Troubleshoots common issues This skill NEVER: Accesses files without user request Sends data externally Modifies original PDFs

Security & Privacy

All processing is local: PyMuPDF runs entirely on your machine No external API calls No data leaves your system

Plain Text

text = page.get_text()

Structured (dict)

blocks = page.get_text("dict")["blocks"] for b in blocks: if b["type"] == 0: # text block for line in b["lines"]: for span in line["spans"]: print(span["text"], span["size"])

JSON

import json data = page.get_text("json") parsed = json.loads(data)

Full Example

import fitz def extract_pdf(path): """Extract text from PDF, with OCR fallback for scanned pages.""" doc = fitz.open(path) results = [] for i, page in enumerate(doc): text = page.get_text() method = "text" # If very little text, might be scanned if len(text.strip()) < 50: # OCR would go here (see ocr.md) method = "needs_ocr" results.append({ "page": i + 1, "text": text, "method": method }) doc.close() return { "pages": len(results), "content": results, "word_count": sum(len(r["text"].split()) for r in results) } # Usage result = extract_pdf("document.pdf") print(f"Extracted {result['word_count']} words from {result['pages']} pages")

Feedback

Useful? clawhub star extract-pdf-text Stay updated: clawhub sync

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
4 Docs
  • SKILL.md Primary doc
  • examples.md Docs
  • ocr.md Docs
  • troubleshooting.md Docs