pdf-reading
Skill1 starsChanged 7 months agoMITView on GitHub
Use this skill when you need to read, inspect, or extract content from PDF files — especially when file content is NOT in your context and you need to read it from disk. Covers content inventory, text extraction, page rasterization for visual inspection, embedded image/attachment/table/form-field extraction, and choosing the right reading strategy for different document types (text-heavy, scanned, slide-decks, forms, data-heavy). Do NOT use this skill for PDF creation, form filling, merging, splitting, watermarking, or encryption — use the pdf skill instead.
8 other projects use a version of this, 3 of them edited.
Adopted by
Most recently taken up by
- DAAF-Contribution-Community/daaftheir own version, first seen Nov 8, 2026
- invergent-ai/surogatesedited, first seen Oct 13, 2026
- shahbazaliofficial/Claude-Skillsedited, first seen Oct 13, 2026
- aniketpanjwani/skillstheir own version, first seen Aug 17, 2026
- keirsalterego/jailbreak-fableedited, first seen Jun 12, 2026
- Aerex0/claude-skillsword for word, first seen Apr 20, 2026
Other versions8 projects use a version of this.
Word for word · 3
- Wide-Moat/open-computer-use★ 126100% same
- SeifBenayed/cloclo★ 114100% same
- Aerex0/claude-skills★ 3100% same
Edited · 3
- keirsalterego/jailbreak-fable★ 41100% same
- invergent-ai/surogates★ 2873% same
- shahbazaliofficial/Claude-Skills★ 088% same
Wrote their own version · 2
- DAAF-Contribution-Community/daaf★ 239same name
- aniketpanjwani/skills★ 52same 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 repository29 other files it gives its agents.
- algorithmic-artSkill
- benepass-reimbursementSkill
- brand-guidelinesSkill
- call-to-bookSkill
- cancel-unsubscribeSkill
- canvas-designSkill
- doc-coauthoringSkill
- event-planningSkill
- file-expensesSkill
- file-formSkill
- financial-calculatorSkill
- grocery-shoppingSkill
- hire-helpSkill
- internal-commsSkill
- mcp-builderSkill
- meal-deliverySkill
- prescription-refillSkill
- return-refundSkill
- skill-creatorSkill
- slack-gif-creatorSkill
- theme-factorySkill
- web-artifacts-builderSkill
- docxSkill
- file-readingSkill
- frontend-designSkill
- pdfSkill
- pptxSkill
- product-self-knowledgeSkill
- xlsxSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
4
Distinctive
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
- Distinctive: line 15
Before doing anything with a PDF, understand what you're working with.
- Very specific: line 19
Run a quick diagnostic first.
- Distinctive: line 118
Only rasterize pages that matter for the question at hand.
- Distinctive: line 269
If text extraction produces garbled output (wrong characters, missing text, mojibake), check the font situation:
- Distinctive: line 276
Look at the "emb" column — if fonts show "no" (not embedded) with custom encodings, the PDF's character mapping may be broken for text …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PDF Processing Guide
Overview
This guide covers essential PDF reading operations using Python libraries and command-line tools. For advanced features (pypdfium2 rendering, pdfplumber table settings, OCR fallback, encrypted/corrupted PDF handling), see REFERENCE.md.
Reading & Inspecting PDFs
Before doing anything with a PDF, understand what you're working with.
Content inventory
Run a quick diagnostic first. For simple tasks ("summarize this
document"), pdfinfo + a text sample may suffice. For anything
involving figures, attachments, or extraction issues, run the full set:
# Always: page count, file size, PDF version, metadata
pdfinfo document.pdf
# Always: quick text extraction check — is this a text PDF or a scan?
pdftotext -f 1 -l 1 document.pdf - | head -20
# If figures/charts may matter:
pdfimages -list document.pdf
# If the PDF might contain embedded files (reports, portfolios):
pdfdetach -list document.pdf
# If text extraction looks garbled:
pdffonts document.pdfThis tells you:
- Page count and size — how big is the job?
- Text extractability — does
pdftotextreturn real text, or is it empty (scanned) or garbled (broken font encoding)? - Embedded raster images — are there photos or raster figures? (Note: vector-drawn charts from matplotlib/Excel won't appear — see "Extracting embedded images" below)
- Attachments — are there embedded spreadsheets, data files, etc.?
- Font status — are fonts embedded? If not, text extraction may produce wrong characters.
Text extraction
pypdf for basic text:
from pypdf import PdfReader
reader = PdfReader("document.pdf")
print(f"Pages: {len(reader.pages)}")
# Extract text
text = ""
for page in reader.pages:
text += page.extract_text()pdftotext preserving layout (better for multi-column docs):
# Layout mode preserves spatial positioning
pdftotext -layout document.pdf output.txt
# Specific page range
pdftotext -f 1 -l 5 document.pdf output.txtpdfplumber for layout-aware extraction with positioning data:
import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
for page in pdf.pages:
text = page.extract_text()
print(text)Visual inspection (rasterize pages)
Text extraction is blind to charts, diagrams, figures, equations, multi-column layout, and form structures. When any of these matter, rasterize the relevant page and Read the image:
# Rasterize a single page (page 3 here) at 150 DPI
pdftoppm -jpeg -r 150 -f 3 -l 3 document.pdf /tmp/page
# pdftoppm zero-pads the output filename based on TOTAL page count
# (e.g., page-03.jpg for a 50-page PDF, page-003.jpg for 200+ pages)
# Don't guess the filename — find it:
ls /tmp/page-*.jpgThen Read the resulting image file. This gives you full visual understanding of that page — layout, charts, equations, everything.
When to rasterize vs. text-extract:
- Content/data questions → text extraction (cheaper, searchable)
- Figures, charts, visual layout → rasterize the page
- Tables → try text extraction first, rasterize if garbled
- Precision matters → do both (extract text AND rasterize; use text for data, image for context — this is what Claude's API does natively with PDF uploads)
Token cost awareness:
- Text extraction: ~200–400 tokens per page
- Rasterized image: ~1,600 tokens per page (at 150 DPI)
- Both together: ~2,000–2,400 tokens per page
For a 100-page PDF, rasterizing everything would consume ~160K tokens. Only rasterize pages that matter for the question at hand.
Choosing your reading strategy
Text-heavy documents (reports, articles, books): → Text extraction is primary. Rasterize only for specific figures or pages where layout matters.
Scanned documents (no extractable text): → Rasterize pages at 150 DPI and Read them visually. For bulk text extraction, use OCR (pytesseract after converting pages to images — see REFERENCE.md for a complete example).
Slide-deck PDFs (exported presentations): → Every page is primarily visual. Rasterize individual pages on demand. Text extraction gives you bullet-point text but loses all layout.
Form-heavy documents: → Extract form field values programmatically first (see below). Rasterize the form page for visual context if needed.
Data-heavy documents (tables, charts, figures): → Use pdfplumber for tables. Rasterize pages with charts/figures. Extract text for surrounding narrative. Consider both text AND image for the same page when precision matters.
Extracting embedded images
# List all embedded images with metadata (size, color, compression)
pdfimages -list document.pdf
# Extract all images as PNG
pdfimages -png document.pdf /tmp/img
# Extract from specific pages only (pages 3-5)
pdfimages -png -f 3 -l 5 document.pdf /tmp/img
# Extract in original format (JPEG stays JPEG, etc.)
pdfimages -all document.pdf /tmp/imgThen Read /tmp/img-000.png (etc.) to see each extracted image.
Gotcha — vector graphics: pdfimages extracts only raster image
data. Charts and diagrams drawn as vector graphics (common in
matplotlib, Excel, and R exports) will NOT appear — they are page
content operators, not image objects. For these, rasterize the whole
page with pdftoppm instead.
Gotcha — empty images: pdfimages sometimes produces many tiny or
empty image files — these are typically background masks, transparency
layers, or decorative elements. Filter by file size to find the real
content images.
Programmatic extraction with position data:
import fitz # PyMuPDF
doc = fitz.open("document.pdf")
for page in doc:
for img in page.get_images():
xref = img[0]
pix = fitz.Pixmap(doc, xref)
if pix.n - pix.alpha > 3: # CMYK or other non-RGB
pix = fitz.Pixmap(fitz.csRGB, pix)
pix.save(f"/tmp/img_{xref}.png")Extracting file attachments
PDFs can contain embedded files — spreadsheets, data files, other documents. Common in business reports, PDF portfolios, and PDF/A-3 compliance documents.
# List all attachments
pdfdetach -list document.pdf
# Extract all attachments to a directory
mkdir -p /tmp/attachments
pdfdetach -saveall -o /tmp/attachments/ document.pdf
# Extract a specific attachment by number (1-based index from -list output)
pdfdetach -save 1 -o /tmp/attachment.pdf document.pdfIn Python:
import os
from pypdf import PdfReader
reader = PdfReader("document.pdf")
for name, content_list in reader.attachments.items():
safe_name = os.path.basename(name) # sanitize — name comes from the PDF
for content in content_list:
with open(f"/tmp/{safe_name}", "wb") as f:
f.write(content)Two attachment mechanisms exist in PDFs: page-level file annotation
attachments (shown as paperclip icons in viewers) and document-level
embedded files (in the EmbeddedFiles name tree). Both pdfdetach and
pypdf handle the common cases. Rich media assets (3D, video) embedded
as annotations may not appear in the attachment list — use PyMuPDF to
iterate page annotations for those.
Extracting form field data
PDFs with interactive forms (government forms, applications, contracts) have fillable fields whose values can be read programmatically:
from pypdf import PdfReader
reader = PdfReader("form.pdf")
# Text input fields only:
fields = reader.get_form_text_fields()
for name, value in fields.items():
print(f"{name}: {value}")
# All field types (checkboxes, radio buttons, dropdowns too):
all_fields = reader.get_fields() or {}
for name, field in all_fields.items():
print(f"{name}: {field.get('/V', '')} (type: {field.get('/FT', '')})")get_form_text_fields() returns only text input fields. For
government forms and contracts that use checkboxes, radio buttons,
and dropdowns, use get_fields() instead to see all field types.
For comprehensive field info (types, options, defaults):
pdftk form.pdf dump_data_fieldsFor anything beyond reading form data — filling forms, creating forms —
use the pdf skill at /mnt/skills/public/pdf/SKILL.md.
Audio, video, and other rare embedded content
PDFs can occasionally embed audio, video, or 3D models. Check
pdfdetach -list first — if the media appears as an attachment,
extract with pdfdetach -saveall. If not, it may be a Rich Media
annotation (harder to extract; requires PyMuPDF to iterate page
annotations). This is very rare in practice. Most PDF viewers outside
Adobe Acrobat do not support media playback.
Font diagnostics
If text extraction produces garbled output (wrong characters, missing text, mojibake), check the font situation:
pdffonts document.pdfLook at the "emb" column — if fonts show "no" (not embedded) with custom encodings, the PDF's character mapping may be broken for text extraction. In that case, rasterize the page and use vision instead.
Also check encoding: fonts with "Custom" or "Identity-H" encoding without embedded CIDToGID maps can cause character substitution issues even when the font is technically embedded.
Quick Reference
| Task | Best Tool | Command/Code |
| Inspect PDF | poppler-utils | pdfinfo, pdfimages -list, pdfdetach -list, pdffonts |
| Extract text | pdfplumber | page.extract_text() |
| Extract text (CLI) | pdftotext | pdftotext -layout input.pdf output.txt |
| Extract tables | pdfplumber | page.extract_tables() |
| See page visually | pdftoppm | pdftoppm -jpeg -r 150 -f N -l N |
| Extract images | pdfimages | pdfimages -png input.pdf prefix |
| Extract attachments | pdfdetach | pdfdetach -saveall -o /tmp/ |
| Read form fields | pypdf | reader.get_fields() |
| OCR scanned PDFs | pytesseract | Convert to image first |
PDF Form Filling, Creation, Merging, Splitting, and Other Operations
This skill covers reading and inspection only. For filling forms,
creating, merging, splitting, rotating, watermarking, encrypting, or
other PDF manipulation tasks, use the public pdf skill at
/mnt/skills/public/pdf/SKILL.md.
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.

