pdf-extract
Skill1 starsChanged 4 months agoMITView on GitHub
Use when the user wants to extract text, tables, or images from a PDF file — including scanned/image-only PDFs needing OCR — or asks to "read this PDF", "extract text from PDF", "what's in this PDF", or to pull tables/images out of one.
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- stonegiantstudio/skillstheir own version, first seen Sep 29, 2026
- ghbhiee/skillstheir own version, first seen Aug 21, 2026
- ilhankilic/yaratai-skilltheir own version, first seen Apr 14, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- stonegiantstudio/skills★ 2same name
- ghbhiee/skills★ 1same name
- ilhankilic/yaratai-skill★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-test-suiteSkill
- ascii-artSkill
- caddy-reverse-proxySkill
- changelog-generatorSkill
- color-palette-generatorSkill
- cron-taskSkill
- csv-toolkitSkill
- discord-bot-buildSkill
- docker-umbrellaSkill
- dotfiles-manageSkill
- email-sendSkill
- env-config-managerSkill
- excalidraw-diagramSkill
- file-organizerSkill
- forgejo-self-hostSkill
- frontend-design-toolkitSkill
- generate-dockerfileSkill
- gif-searchSkill
- git-backupSkill
- github-actions-ciSkill
- hallmark-readmeSkill
- http-api-testerSkill
- invoice-generatorSkill
- json-formatterSkill
- log-analyzerSkill
- markdown-linterSkill
- markdown-to-pdfSkill
- markdown-to-slidesSkill
- mcp-server-buildSkill
- media-id-mappingSkill
- movie-catalogue-siteSkill
- movie-night-calendarSkill
- ntfy-notifierSkill
- ocr-documentsSkill
- ollama-localSkill
- openapi-generatorSkill
- password-generatorSkill
- portfolio-upkeepSkill
- qr-code-generatorSkill
- regex-testerSkill
- resume-builderSkill
- rss-monitorSkill
- searxng-self-hostSkill
- skill-publishSkill
- skill-registry-catalogSkill
- skills-portfolio-scaffoldSkill
- snippet-managerSkill
- sqlite-dashboardSkill
- streaming-provider-embedsSkill
- tailscale-deploySkill
- telegram-bot-buildSkill
- tmdb-metadataSkill
- uptime-kuma-self-hostSkill
- watchlist-syncSkill
- webhook-receiverSkill
- youtube-transcriptSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 107
If get_text() returns empty or near-empty, the PDF is likely scanned images.
- Distinctive: line 144
If text is sparse (< 50 chars/page average), fall back to OCR
- Distinctive: line 145
If the user needs tables, use pdfplumber
- Distinctive: line 146
If the user needs images, extract with pymupdf's image API
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
pdf-extract
Overview
Extract text, images, and tables from PDF files using open-source Python libraries. The agent handles PDF parsing, OCR fallback for scanned documents, and structured output.
When to Use
- The user wants to extract text from a PDF.
- The user has a scanned PDF that needs OCR.
- The user wants to pull tables or images out of a PDF.
- The user says "read this PDF", "extract text from PDF", or "what's in this PDF".
Prerequisites
pip install pymupdf pdfplumber pillow
# For OCR fallback:
pip install pytesseract
# Also install tesseract-ocr system package:
# Linux: apt install tesseract-ocr
# macOS: brew install tesseract
# Windows: download from https://github.com/UB-Mannheim/tesseract/wikiText Extraction
Basic text extraction (pymupdf)
import fitz # pymupdf
def extract_text(pdf_path: str) -> str:
doc = fitz.open(pdf_path)
text = []
for page in doc:
text.append(page.get_text())
return "\n".join(text)With page numbers
def extract_text_with_pages(pdf_path: str) -> list[dict]:
doc = fitz.open(pdf_path)
pages = []
for i, page in enumerate(doc):
pages.append({
"page": i + 1,
"text": page.get_text()
})
return pagesTable Extraction
import pdfplumber
def extract_tables(pdf_path: str) -> list:
tables = []
with pdfplumber.open(pdf_path) as pdf:
for i, page in enumerate(pdf.pages):
page_tables = page.extract_tables()
for table in page_tables:
tables.append({"page": i + 1, "rows": table})
return tablesImage Extraction
import fitz
import os
def extract_images(pdf_path: str, output_dir: str = "./extracted_images"):
os.makedirs(output_dir, exist_ok=True)
doc = fitz.open(pdf_path)
images = []
for page_num, page in enumerate(doc):
for img_index, img in enumerate(page.get_images(full=True)):
xref = img[0]
base_image = doc.extract_image(xref)
image_bytes = base_image["image"]
ext = base_image["ext"]
filename = f"{output_dir}/page{page_num+1}_img{img_index+1}.{ext}"
with open(filename, "wb") as f:
f.write(image_bytes)
images.append(filename)
return imagesOCR Fallback (for scanned PDFs)
If get_text() returns empty or near-empty, the PDF is likely scanned images. Use OCR:
import fitz
import pytesseract
from PIL import Image
import io
def extract_with_ocr(pdf_path: str) -> str:
doc = fitz.open(pdf_path)
text = []
for page in doc:
# Render page to image at 300 DPI
pix = page.get_pixmap(dpi=300)
img = Image.open(io.BytesIO(pix.tobytes("png")))
page_text = pytesseract.image_to_string(img)
text.append(page_text)
return "\n".join(text)Auto-detect: text vs scanned
def extract_pdf(pdf_path: str) -> str:
doc = fitz.open(pdf_path)
# Try direct text extraction
total_text = "".join(page.get_text() for page in doc)
# If less than 50 chars per page on average, use OCR
if len(total_text) / len(doc) < 50:
return extract_with_ocr(pdf_path)
return total_textWorkflow
- Identify the PDF file path
- Try direct text extraction with pymupdf
- If text is sparse (< 50 chars/page average), fall back to OCR
- If the user needs tables, use pdfplumber
- If the user needs images, extract with pymupdf's image API
- Return structured output (text, tables, or image paths)
Common Pitfalls
- Scanned PDFs return empty text.
get_text()returns""for image-only PDFs — always check text length and fall back to OCR. - OCR is slow. Rendering at 300 DPI and running tesseract takes 2-5 seconds per page — warn the user before running it on large PDFs.
- Encrypted PDFs fail to open.
fitz.open()raises on password-protected PDFs — calldoc.authenticate("password")first if the password is known. - Table extraction quality varies. pdfplumber handles bordered tables well but struggles with borderless ones — check the output before trusting it.
- Large PDFs exhaust memory. A 500-page PDF loaded whole with pymupdf can use significant RAM — process pages one at a time if memory is constrained.
- Missing Tesseract language packs. Non-English PDFs need the matching pack (e.g.
tesseract-ocr-fra) installed andlang='fra'passed toimage_to_string, or OCR silently produces garbage text.
Verification Checklist
- Checked average chars/page before deciding text-extraction vs. OCR
- Extracted text/table/image count is consistent with the source PDF's page count
- OCR output spot-checked for garbled text when a scanned PDF was processed
- Correct Tesseract language pack used for non-English documents
- Password-protected PDFs authenticated successfully before extraction was attempted
- Output files (images, extracted text/tables) saved where the user expects them
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

