# PDF Extraction

Extract text, tables, and metadata from PDFs using pdfplumber

- Repository: https://github.com/claude-office-skills/skills (556 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-01-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add claude-office-skills/skills --skill pdf-extraction -g -a claude-code -y`
Codex: `npx skills add claude-office-skills/skills --skill pdf-extraction -g -a codex -y`
Cursor: `npx skills add claude-office-skills/skills --skill pdf-extraction -g -a cursor -y`
Gemini CLI: `npx skills add claude-office-skills/skills --skill pdf-extraction -g -a gemini-cli -y`

## Description

Extract text, tables, and metadata from PDFs using pdfplumber

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# PDF Extraction Skill

## Overview

This skill enables precise extraction of text, tables, and metadata from PDF documents using **pdfplumber** - the go-to library for PDF data extraction. Unlike basic PDF readers, pdfplumber provides detailed character-level positioning, accurate table detection, and visual debugging.

## How to Use

1. Provide the PDF file you want to extract from
2. Specify what you need: text, tables, images, or metadata
3. I'll generate pdfplumber code and execute it

**Example prompts:**
- "Extract all tables from this financial report"
- "Get text from pages 5-10 of this document"
- "Find and extract the invoice total from this PDF"
- "Convert this PDF table to CSV/Excel"

## Domain Knowledge

### pdfplumber Fundamentals

```python
import pdfplumber

# Open PDF
with pdfplumber.open('document.pdf') as pdf:
    # Access pages
    first_page = pdf.pages[0]
    
    # Document metadata
    print(pdf.metadata)
    
    # Number of pages
    print(len(pdf.pages))
```

### PDF Structure
```
PDF Document
├── metadata (title, author, creation date)
├── pages[]
│   ├── chars (individual characters with position)
│   ├── words (grouped characters)
│   ├── lines (horizontal/vertical lines)
│   ├── rects (rectangles)
│   ├── curves (bezier curves)
│   └── images (embedded images)
└── outline (bookmarks/TOC)
```

### Text Extraction

#### Basic Text
```python
with pdfplumber.open('document.pdf') as pdf:
    # Single page
    text = pdf.pages[0].extract_text()
    
    # All pages
    full_text = ''
    for page in pdf.pages:
        full_text += page.extract_text() or ''
```

#### Advanced Text Options
```python
# With layout preservation
text = page.extract_text(
    x_tolerance=3,      # Horizontal tolerance for grouping
    y_tolerance=3,      # Vertical tolerance
    layout=True,        # Preserve layout
    x_density=7.25,     # Chars per unit width
    y_density=13        # Chars per unit height
)

The rest: https://github.com/claude-office-skills/skills/blob/HEAD/pdf-extraction/SKILL.md
