[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BW0ZZYNP8306BN8WMYP349":3,"skill-same:01M7BW0ZZYNP8306BN8WMYP349":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M7BW0ZZYNP8306BN8WMYP349","pdf-extraction",null,"Extract text, tables, and metadata from PDFs using pdfplumber","om-scogo\u002Fskillsh-scraper","om-scogo","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160466840?v=4","01M79AWB6DFVCQ7RK70CS34B96","Om Achrekar","01M79AWB6ZM9SKR8KDH1WSSM22",0,"MIT","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-extraction\u002FSkill.md",[],[],"2026-11-15 14:19:17",false,"---\n# ═══════════════════════════════════════════════════════════════════════════════\n# CLAUDE OFFICE SKILL - Enhanced Metadata v2.0\n# ═══════════════════════════════════════════════════════════════════════════════\n\n# Basic Information\nname: pdf-extraction\ndescription: \"Extract text, tables, and metadata from PDFs using pdfplumber\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: pdf\ntags:\n  - pdf\n  - extraction\n  - text\n  - tables\ndepartment: All\n\n# AI Model Compatibility\nmodels:\n  recommended:\n    - claude-sonnet-4\n    - claude-opus-4\n  compatible:\n    - claude-3-5-sonnet\n    - gpt-4\n    - gpt-4o\n\n# MCP Tools Integration\nmcp:\n  server: office-mcp\n  tools:\n    - extract_text_from_pdf\n    - extract_tables_from_pdf\n\n# Skill Capabilities\ncapabilities:\n  - text_extraction\n  - table_extraction\n  - data_mining\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# PDF Extraction Skill\n\n## Overview\n\nThis 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.\n\n## How to Use\n\n1. Provide the PDF file you want to extract from\n2. Specify what you need: text, tables, images, or metadata\n3. I'll generate pdfplumber code and execute it\n\n**Example prompts:**\n- \"Extract all tables from this financial report\"\n- \"Get text from pages 5-10 of this document\"\n- \"Find and extract the invoice total from this PDF\"\n- \"Convert this PDF table to CSV\u002FExcel\"\n\n## Domain Knowledge\n\n### pdfplumber Fundamentals\n\n```python\nimport pdfplumber\n\n# Open PDF\nwith pdfplumber.open('document.pdf') as pdf:\n    # Access pages\n    first_page = pdf.pages[0]\n    \n    # Document metadata\n    print(pdf.metadata)\n    \n    # Number of pages\n    print(len(pdf.pages))\n```\n\n### PDF Structure\n```\nPDF Document\n├── metadata (title, author, creation date)\n├── pages[]\n│   ├── chars (individual characters with position)\n│   ├── words (grouped characters)\n│   ├── lines (horizontal\u002Fvertical lines)\n│   ├── rects (rectangles)\n│   ├── curves (bezier curves)\n│   └── images (embedded images)\n└── outline (bookmarks\u002FTOC)\n```\n\n### Text Extraction\n\n#### Basic Text\n```python\nwith pdfplumber.open('document.pdf') as pdf:\n    # Single page\n    text = pdf.pages[0].extract_text()\n    \n    # All pages\n    full_text = ''\n    for page in pdf.pages:\n        full_text += page.extract_text() or ''\n```\n\n#### Advanced Text Options\n```python\n# With layout preservation\ntext = page.extract_text(\n    x_tolerance=3,      # Horizontal tolerance for grouping\n    y_tolerance=3,      # Vertical tolerance\n    layout=True,        # Preserve layout\n    x_density=7.25,     # Chars per unit width\n    y_density=13        # Chars per unit height\n)\n\n# Extract words with positions\nwords = page.extract_words(\n    x_tolerance=3,\n    y_tolerance=3,\n    keep_blank_chars=False,\n    use_text_flow=False\n)\n\n# Each word includes: text, x0, top, x1, bottom, etc.\nfor word in words:\n    print(f\"{word['text']} at ({word['x0']}, {word['top']})\")\n```\n\n#### Character-Level Access\n```python\n# Get all characters\nchars = page.chars\n\nfor char in chars:\n    print(f\"'{char['text']}' at ({char['x0']}, {char['top']})\")\n    print(f\"  Font: {char['fontname']}, Size: {char['size']}\")\n```\n\n### Table Extraction\n\n#### Basic Table Extraction\n```python\nwith pdfplumber.open('report.pdf') as pdf:\n    page = pdf.pages[0]\n    \n    # Extract all tables\n    tables = page.extract_tables()\n    \n    for i, table in enumerate(tables):\n        print(f\"Table {i+1}:\")\n        for row in table:\n            print(row)\n```\n\n#### Advanced Table Settings\n```python\n# Custom table detection\ntable_settings = {\n    \"vertical_strategy\": \"lines\",      # or \"text\", \"explicit\"\n    \"horizontal_strategy\": \"lines\",\n    \"explicit_vertical_lines\": [],     # Custom line positions\n    \"explicit_horizontal_lines\": [],\n    \"snap_tolerance\": 3,\n    \"snap_x_tolerance\": 3,\n    \"snap_y_tolerance\": 3,\n    \"join_tolerance\": 3,\n    \"edge_min_length\": 3,\n    \"min_words_vertical\": 3,\n    \"min_words_horizontal\": 1,\n    \"intersection_tolerance\": 3,\n    \"text_tolerance\": 3,\n    \"text_x_tolerance\": 3,\n    \"text_y_tolerance\": 3,\n}\n\ntables = page.extract_tables(table_settings)\n```\n\n#### Table Finding\n```python\n# Find tables (without extracting)\ntable_finder = page.find_tables()\n\nfor table in table_finder:\n    print(f\"Table at: {table.bbox}\")  # (x0, top, x1, bottom)\n    \n    # Extract specific table\n    data = table.extract()\n```\n\n### Visual Debugging\n\n```python\n# Create visual debug image\nim = page.to_image(resolution=150)\n\n# Draw detected objects\nim.draw_rects(page.chars)        # Character bounding boxes\nim.draw_rects(page.words)        # Word bounding boxes\nim.draw_lines(page.lines)        # Lines\nim.draw_rects(page.rects)        # Rectangles\n\n# Save debug image\nim.save('debug.png')\n\n# Debug tables\nim.reset()\nim.debug_tablefinder()\nim.save('table_debug.png')\n```\n\n### Cropping and Filtering\n\n#### Crop to Region\n```python\n# Define bounding box (x0, top, x1, bottom)\nbbox = (0, 0, 300, 200)\n\n# Crop page\ncropped = page.crop(bbox)\n\n# Extract from cropped area\ntext = cropped.extract_text()\ntables = cropped.extract_tables()\n```\n\n#### Filter by Position\n```python\n# Filter characters by region\ndef within_bbox(obj, bbox):\n    x0, top, x1, bottom = bbox\n    return (obj['x0'] >= x0 and obj['x1'] \u003C= x1 and\n            obj['top'] >= top and obj['bottom'] \u003C= bottom)\n\nbbox = (100, 100, 400, 300)\nfiltered_chars = [c for c in page.chars if within_bbox(c, bbox)]\n```\n\n#### Filter by Font\n```python\n# Get text by font\ndef extract_by_font(page, font_name):\n    chars = [c for c in page.chars if font_name in c['fontname']]\n    return ''.join(c['text'] for c in chars)\n\n# Extract bold text (often \"Bold\" in font name)\nbold_text = extract_by_font(page, 'Bold')\n\n# Extract by size\nlarge_chars = [c for c in page.chars if c['size'] > 14]\n```\n\n### Metadata and Structure\n\n```python\nwith pdfplumber.open('document.pdf') as pdf:\n    # Document metadata\n    meta = pdf.metadata\n    print(f\"Title: {meta.get('Title')}\")\n    print(f\"Author: {meta.get('Author')}\")\n    print(f\"Created: {meta.get('CreationDate')}\")\n    \n    # Page info\n    for i, page in enumerate(pdf.pages):\n        print(f\"Page {i+1}: {page.width} x {page.height}\")\n        print(f\"  Rotation: {page.rotation}\")\n```\n\n## Best Practices\n\n1. **Debug Visually**: Use `to_image()` to understand PDF structure\n2. **Tune Table Settings**: Adjust tolerances for your specific PDF\n3. **Handle Scanned PDFs**: Use OCR first (this skill is for native text)\n4. **Process Page by Page**: For large PDFs, avoid loading all at once\n5. **Check for Text**: Some PDFs are images - verify text exists\n\n## Common Patterns\n\n### Extract All Tables to DataFrames\n```python\nimport pandas as pd\n\ndef pdf_tables_to_dataframes(pdf_path):\n    \"\"\"Extract all tables from PDF as pandas DataFrames.\"\"\"\n    dfs = []\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        for i, page in enumerate(pdf.pages):\n            tables = page.extract_tables()\n            \n            for j, table in enumerate(tables):\n                if table and len(table) > 1:\n                    # First row as header\n                    df = pd.DataFrame(table[1:], columns=table[0])\n                    df['_page'] = i + 1\n                    df['_table'] = j + 1\n                    dfs.append(df)\n    \n    return dfs\n```\n\n### Extract Specific Region\n```python\ndef extract_invoice_amount(pdf_path):\n    \"\"\"Extract amount from typical invoice layout.\"\"\"\n    with pdfplumber.open(pdf_path) as pdf:\n        page = pdf.pages[0]\n        \n        # Search for \"Total\" and get nearby numbers\n        words = page.extract_words()\n        \n        for i, word in enumerate(words):\n            if 'total' in word['text'].lower():\n                # Look at next few words\n                for next_word in words[i+1:i+5]:\n                    text = next_word['text'].replace(',', '').replace('$', '')\n                    try:\n                        return float(text)\n                    except ValueError:\n                        continue\n    \n    return None\n```\n\n### Multi-column Layout\n```python\ndef extract_columns(page, num_columns=2):\n    \"\"\"Extract text from multi-column layout.\"\"\"\n    width = page.width\n    col_width = width \u002F num_columns\n    \n    columns = []\n    for i in range(num_columns):\n        x0 = i * col_width\n        x1 = (i + 1) * col_width\n        \n        cropped = page.crop((x0, 0, x1, page.height))\n        columns.append(cropped.extract_text())\n    \n    return columns\n```\n\n## Examples\n\n### Example 1: Financial Report Table Extraction\n```python\nimport pdfplumber\nimport pandas as pd\n\ndef extract_financial_tables(pdf_path):\n    \"\"\"Extract tables from financial report and save to Excel.\"\"\"\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        all_tables = []\n        \n        for page_num, page in enumerate(pdf.pages):\n            # Debug: save table visualization\n            im = page.to_image()\n            im.debug_tablefinder()\n            im.save(f'debug_page_{page_num+1}.png')\n            \n            # Extract tables\n            tables = page.extract_tables({\n                \"vertical_strategy\": \"lines\",\n                \"horizontal_strategy\": \"lines\",\n                \"snap_tolerance\": 5,\n            })\n            \n            for table in tables:\n                if table and len(table) > 1:\n                    # Clean data\n                    clean_table = []\n                    for row in table:\n                        clean_row = [cell.strip() if cell else '' for cell in row]\n                        clean_table.append(clean_row)\n                    \n                    df = pd.DataFrame(clean_table[1:], columns=clean_table[0])\n                    df['Source Page'] = page_num + 1\n                    all_tables.append(df)\n        \n        # Save to Excel with multiple sheets\n        with pd.ExcelWriter('extracted_tables.xlsx') as writer:\n            for i, df in enumerate(all_tables):\n                df.to_excel(writer, sheet_name=f'Table_{i+1}', index=False)\n        \n        return all_tables\n\ntables = extract_financial_tables('annual_report.pdf')\nprint(f\"Extracted {len(tables)} tables\")\n```\n\n### Example 2: Invoice Data Extraction\n```python\nimport pdfplumber\nimport re\nfrom datetime import datetime\n\ndef extract_invoice_data(pdf_path):\n    \"\"\"Extract structured data from invoice PDF.\"\"\"\n    \n    data = {\n        'invoice_number': None,\n        'date': None,\n        'total': None,\n        'line_items': []\n    }\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        page = pdf.pages[0]\n        text = page.extract_text()\n        \n        # Extract invoice number\n        inv_match = re.search(r'Invoice\\s*#?\\s*:?\\s*(\\w+)', text, re.IGNORECASE)\n        if inv_match:\n            data['invoice_number'] = inv_match.group(1)\n        \n        # Extract date\n        date_match = re.search(r'Date\\s*:?\\s*(\\d{1,2}[\u002F-]\\d{1,2}[\u002F-]\\d{2,4})', text)\n        if date_match:\n            data['date'] = date_match.group(1)\n        \n        # Extract total\n        total_match = re.search(r'Total\\s*:?\\s*\\$?([\\d,]+\\.?\\d*)', text, re.IGNORECASE)\n        if total_match:\n            data['total'] = float(total_match.group(1).replace(',', ''))\n        \n        # Extract line items from table\n        tables = page.extract_tables()\n        for table in tables:\n            if table and any('description' in str(row).lower() for row in table[:2]):\n                # Found line items table\n                for row in table[1:]:  # Skip header\n                    if row and len(row) >= 3:\n                        data['line_items'].append({\n                            'description': row[0],\n                            'quantity': row[1] if len(row) > 1 else None,\n                            'amount': row[-1]\n                        })\n    \n    return data\n\ninvoice = extract_invoice_data('invoice.pdf')\nprint(f\"Invoice #{invoice['invoice_number']}\")\nprint(f\"Total: ${invoice['total']}\")\n```\n\n### Example 3: Resume\u002FCV Parser\n```python\nimport pdfplumber\n\ndef parse_resume(pdf_path):\n    \"\"\"Extract structured sections from resume.\"\"\"\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        full_text = ''\n        for page in pdf.pages:\n            full_text += (page.extract_text() or '') + '\\n'\n        \n        # Common resume sections\n        sections = {\n            'contact': '',\n            'summary': '',\n            'experience': '',\n            'education': '',\n            'skills': ''\n        }\n        \n        # Split by common headers\n        import re\n        section_patterns = {\n            'summary': r'(summary|objective|profile)',\n            'experience': r'(experience|employment|work history)',\n            'education': r'(education|academic)',\n            'skills': r'(skills|competencies|technical)'\n        }\n        \n        lines = full_text.split('\\n')\n        current_section = 'contact'\n        \n        for line in lines:\n            line_lower = line.lower().strip()\n            \n            # Check if line is a section header\n            for section, pattern in section_patterns.items():\n                if re.match(pattern, line_lower):\n                    current_section = section\n                    break\n            \n            sections[current_section] += line + '\\n'\n        \n        return sections\n\nresume = parse_resume('resume.pdf')\nprint(\"Skills:\", resume['skills'])\n```\n\n## Limitations\n\n- Cannot extract from scanned\u002Fimage PDFs (use OCR first)\n- Complex layouts may need manual tuning\n- Some PDF encryption types not supported\n- Embedded fonts may affect text extraction\n- No direct PDF editing capability\n\n## Installation\n\n```bash\npip install pdfplumber\n\n# For image debugging (optional)\npip install Pillow\n```\n\n## Resources\n\n- [pdfplumber Documentation](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber)\n- [Table Extraction Guide](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber#extracting-tables)\n- [Visual Debugging](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber#visual-debugging)\n","# PDF Extraction Skill\n\n## Overview\n\nThis 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.\n\n## How to Use\n\n1. Provide the PDF file you want to extract from\n2. Specify what you need: text, tables, images, or metadata\n3. I'll generate pdfplumber code and execute it\n\n**Example prompts:**\n- \"Extract all tables from this financial report\"\n- \"Get text from pages 5-10 of this document\"\n- \"Find and extract the invoice total from this PDF\"\n- \"Convert this PDF table to CSV\u002FExcel\"\n\n## Domain Knowledge\n\n### pdfplumber Fundamentals\n\n```python\nimport pdfplumber\n\n# Open PDF\nwith pdfplumber.open('document.pdf') as pdf:\n    # Access pages\n    first_page = pdf.pages[0]\n    \n    # Document metadata\n    print(pdf.metadata)\n    \n    # Number of pages\n    print(len(pdf.pages))\n```\n\n### PDF Structure\n```\nPDF Document\n├── metadata (title, author, creation date)\n├── pages[]\n│   ├── chars (individual characters with position)\n│   ├── words (grouped characters)\n│   ├── lines (horizontal\u002Fvertical lines)\n│   ├── rects (rectangles)\n│   ├── curves (bezier curves)\n│   └── images (embedded images)\n└── outline (bookmarks\u002FTOC)\n```\n\n### Text Extraction\n\n#### Basic Text\n```python\nwith pdfplumber.open('document.pdf') as pdf:\n    # Single page\n    text = pdf.pages[0].extract_text()\n    \n    # All pages\n    full_text = ''\n    for page in pdf.pages:\n        full_text += page.extract_text() or ''\n```\n\n#### Advanced Text Options\n```python\n# With layout preservation\ntext = page.extract_text(\n    x_tolerance=3,      # Horizontal tolerance for grouping\n    y_tolerance=3,      # Vertical tolerance\n    layout=True,        # Preserve layout\n    x_density=7.25,     # Chars per unit width\n    y_density=13        # Chars per unit height\n)\n\n# Extract words with positions\nwords = page.extract_words(\n    x_tolerance=3,\n    y_tolerance=3,\n    keep_blank_chars=False,\n    use_text_flow=False\n)\n\n# Each word includes: text, x0, top, x1, bottom, etc.\nfor word in words:\n    print(f\"{word['text']} at ({word['x0']}, {word['top']})\")\n```\n\n#### Character-Level Access\n```python\n# Get all characters\nchars = page.chars\n\nfor char in chars:\n    print(f\"'{char['text']}' at ({char['x0']}, {char['top']})\")\n    print(f\"  Font: {char['fontname']}, Size: {char['size']}\")\n```\n\n### Table Extraction\n\n#### Basic Table Extraction\n```python\nwith pdfplumber.open('report.pdf') as pdf:\n    page = pdf.pages[0]\n    \n    # Extract all tables\n    tables = page.extract_tables()\n    \n    for i, table in enumerate(tables):\n        print(f\"Table {i+1}:\")\n        for row in table:\n            print(row)\n```\n\n#### Advanced Table Settings\n```python\n# Custom table detection\ntable_settings = {\n    \"vertical_strategy\": \"lines\",      # or \"text\", \"explicit\"\n    \"horizontal_strategy\": \"lines\",\n    \"explicit_vertical_lines\": [],     # Custom line positions\n    \"explicit_horizontal_lines\": [],\n    \"snap_tolerance\": 3,\n    \"snap_x_tolerance\": 3,\n    \"snap_y_tolerance\": 3,\n    \"join_tolerance\": 3,\n    \"edge_min_length\": 3,\n    \"min_words_vertical\": 3,\n    \"min_words_horizontal\": 1,\n    \"intersection_tolerance\": 3,\n    \"text_tolerance\": 3,\n    \"text_x_tolerance\": 3,\n    \"text_y_tolerance\": 3,\n}\n\ntables = page.extract_tables(table_settings)\n```\n\n#### Table Finding\n```python\n# Find tables (without extracting)\ntable_finder = page.find_tables()\n\nfor table in table_finder:\n    print(f\"Table at: {table.bbox}\")  # (x0, top, x1, bottom)\n    \n    # Extract specific table\n    data = table.extract()\n```\n\n### Visual Debugging\n\n```python\n# Create visual debug image\nim = page.to_image(resolution=150)\n\n# Draw detected objects\nim.draw_rects(page.chars)        # Character bounding boxes\nim.draw_rects(page.words)        # Word bounding boxes\nim.draw_lines(page.lines)        # Lines\nim.draw_rects(page.rects)        # Rectangles\n\n# Save debug image\nim.save('debug.png')\n\n# Debug tables\nim.reset()\nim.debug_tablefinder()\nim.save('table_debug.png')\n```\n\n### Cropping and Filtering\n\n#### Crop to Region\n```python\n# Define bounding box (x0, top, x1, bottom)\nbbox = (0, 0, 300, 200)\n\n# Crop page\ncropped = page.crop(bbox)\n\n# Extract from cropped area\ntext = cropped.extract_text()\ntables = cropped.extract_tables()\n```\n\n#### Filter by Position\n```python\n# Filter characters by region\ndef within_bbox(obj, bbox):\n    x0, top, x1, bottom = bbox\n    return (obj['x0'] >= x0 and obj['x1'] \u003C= x1 and\n            obj['top'] >= top and obj['bottom'] \u003C= bottom)\n\nbbox = (100, 100, 400, 300)\nfiltered_chars = [c for c in page.chars if within_bbox(c, bbox)]\n```\n\n#### Filter by Font\n```python\n# Get text by font\ndef extract_by_font(page, font_name):\n    chars = [c for c in page.chars if font_name in c['fontname']]\n    return ''.join(c['text'] for c in chars)\n\n# Extract bold text (often \"Bold\" in font name)\nbold_text = extract_by_font(page, 'Bold')\n\n# Extract by size\nlarge_chars = [c for c in page.chars if c['size'] > 14]\n```\n\n### Metadata and Structure\n\n```python\nwith pdfplumber.open('document.pdf') as pdf:\n    # Document metadata\n    meta = pdf.metadata\n    print(f\"Title: {meta.get('Title')}\")\n    print(f\"Author: {meta.get('Author')}\")\n    print(f\"Created: {meta.get('CreationDate')}\")\n    \n    # Page info\n    for i, page in enumerate(pdf.pages):\n        print(f\"Page {i+1}: {page.width} x {page.height}\")\n        print(f\"  Rotation: {page.rotation}\")\n```\n\n## Best Practices\n\n1. **Debug Visually**: Use `to_image()` to understand PDF structure\n2. **Tune Table Settings**: Adjust tolerances for your specific PDF\n3. **Handle Scanned PDFs**: Use OCR first (this skill is for native text)\n4. **Process Page by Page**: For large PDFs, avoid loading all at once\n5. **Check for Text**: Some PDFs are images - verify text exists\n\n## Common Patterns\n\n### Extract All Tables to DataFrames\n```python\nimport pandas as pd\n\ndef pdf_tables_to_dataframes(pdf_path):\n    \"\"\"Extract all tables from PDF as pandas DataFrames.\"\"\"\n    dfs = []\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        for i, page in enumerate(pdf.pages):\n            tables = page.extract_tables()\n            \n            for j, table in enumerate(tables):\n                if table and len(table) > 1:\n                    # First row as header\n                    df = pd.DataFrame(table[1:], columns=table[0])\n                    df['_page'] = i + 1\n                    df['_table'] = j + 1\n                    dfs.append(df)\n    \n    return dfs\n```\n\n### Extract Specific Region\n```python\ndef extract_invoice_amount(pdf_path):\n    \"\"\"Extract amount from typical invoice layout.\"\"\"\n    with pdfplumber.open(pdf_path) as pdf:\n        page = pdf.pages[0]\n        \n        # Search for \"Total\" and get nearby numbers\n        words = page.extract_words()\n        \n        for i, word in enumerate(words):\n            if 'total' in word['text'].lower():\n                # Look at next few words\n                for next_word in words[i+1:i+5]:\n                    text = next_word['text'].replace(',', '').replace('$', '')\n                    try:\n                        return float(text)\n                    except ValueError:\n                        continue\n    \n    return None\n```\n\n### Multi-column Layout\n```python\ndef extract_columns(page, num_columns=2):\n    \"\"\"Extract text from multi-column layout.\"\"\"\n    width = page.width\n    col_width = width \u002F num_columns\n    \n    columns = []\n    for i in range(num_columns):\n        x0 = i * col_width\n        x1 = (i + 1) * col_width\n        \n        cropped = page.crop((x0, 0, x1, page.height))\n        columns.append(cropped.extract_text())\n    \n    return columns\n```\n\n## Examples\n\n### Example 1: Financial Report Table Extraction\n```python\nimport pdfplumber\nimport pandas as pd\n\ndef extract_financial_tables(pdf_path):\n    \"\"\"Extract tables from financial report and save to Excel.\"\"\"\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        all_tables = []\n        \n        for page_num, page in enumerate(pdf.pages):\n            # Debug: save table visualization\n            im = page.to_image()\n            im.debug_tablefinder()\n            im.save(f'debug_page_{page_num+1}.png')\n            \n            # Extract tables\n            tables = page.extract_tables({\n                \"vertical_strategy\": \"lines\",\n                \"horizontal_strategy\": \"lines\",\n                \"snap_tolerance\": 5,\n            })\n            \n            for table in tables:\n                if table and len(table) > 1:\n                    # Clean data\n                    clean_table = []\n                    for row in table:\n                        clean_row = [cell.strip() if cell else '' for cell in row]\n                        clean_table.append(clean_row)\n                    \n                    df = pd.DataFrame(clean_table[1:], columns=clean_table[0])\n                    df['Source Page'] = page_num + 1\n                    all_tables.append(df)\n        \n        # Save to Excel with multiple sheets\n        with pd.ExcelWriter('extracted_tables.xlsx') as writer:\n            for i, df in enumerate(all_tables):\n                df.to_excel(writer, sheet_name=f'Table_{i+1}', index=False)\n        \n        return all_tables\n\ntables = extract_financial_tables('annual_report.pdf')\nprint(f\"Extracted {len(tables)} tables\")\n```\n\n### Example 2: Invoice Data Extraction\n```python\nimport pdfplumber\nimport re\nfrom datetime import datetime\n\ndef extract_invoice_data(pdf_path):\n    \"\"\"Extract structured data from invoice PDF.\"\"\"\n    \n    data = {\n        'invoice_number': None,\n        'date': None,\n        'total': None,\n        'line_items': []\n    }\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        page = pdf.pages[0]\n        text = page.extract_text()\n        \n        # Extract invoice number\n        inv_match = re.search(r'Invoice\\s*#?\\s*:?\\s*(\\w+)', text, re.IGNORECASE)\n        if inv_match:\n            data['invoice_number'] = inv_match.group(1)\n        \n        # Extract date\n        date_match = re.search(r'Date\\s*:?\\s*(\\d{1,2}[\u002F-]\\d{1,2}[\u002F-]\\d{2,4})', text)\n        if date_match:\n            data['date'] = date_match.group(1)\n        \n        # Extract total\n        total_match = re.search(r'Total\\s*:?\\s*\\$?([\\d,]+\\.?\\d*)', text, re.IGNORECASE)\n        if total_match:\n            data['total'] = float(total_match.group(1).replace(',', ''))\n        \n        # Extract line items from table\n        tables = page.extract_tables()\n        for table in tables:\n            if table and any('description' in str(row).lower() for row in table[:2]):\n                # Found line items table\n                for row in table[1:]:  # Skip header\n                    if row and len(row) >= 3:\n                        data['line_items'].append({\n                            'description': row[0],\n                            'quantity': row[1] if len(row) > 1 else None,\n                            'amount': row[-1]\n                        })\n    \n    return data\n\ninvoice = extract_invoice_data('invoice.pdf')\nprint(f\"Invoice #{invoice['invoice_number']}\")\nprint(f\"Total: ${invoice['total']}\")\n```\n\n### Example 3: Resume\u002FCV Parser\n```python\nimport pdfplumber\n\ndef parse_resume(pdf_path):\n    \"\"\"Extract structured sections from resume.\"\"\"\n    \n    with pdfplumber.open(pdf_path) as pdf:\n        full_text = ''\n        for page in pdf.pages:\n            full_text += (page.extract_text() or '') + '\\n'\n        \n        # Common resume sections\n        sections = {\n            'contact': '',\n            'summary': '',\n            'experience': '',\n            'education': '',\n            'skills': ''\n        }\n        \n        # Split by common headers\n        import re\n        section_patterns = {\n            'summary': r'(summary|objective|profile)',\n            'experience': r'(experience|employment|work history)',\n            'education': r'(education|academic)',\n            'skills': r'(skills|competencies|technical)'\n        }\n        \n        lines = full_text.split('\\n')\n        current_section = 'contact'\n        \n        for line in lines:\n            line_lower = line.lower().strip()\n            \n            # Check if line is a section header\n            for section, pattern in section_patterns.items():\n                if re.match(pattern, line_lower):\n                    current_section = section\n                    break\n            \n            sections[current_section] += line + '\\n'\n        \n        return sections\n\nresume = parse_resume('resume.pdf')\nprint(\"Skills:\", resume['skills'])\n```\n\n## Limitations\n\n- Cannot extract from scanned\u002Fimage PDFs (use OCR first)\n- Complex layouts may need manual tuning\n- Some PDF encryption types not supported\n- Embedded fonts may affect text extraction\n- No direct PDF editing capability\n\n## Installation\n\n```bash\npip install pdfplumber\n\n# For image debugging (optional)\npip install Pillow\n```\n\n## Resources\n\n- [pdfplumber Documentation](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber)\n- [Table Extraction Guide](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber#extracting-tables)\n- [Visual Debugging](https:\u002F\u002Fgithub.com\u002Fjsvine\u002Fpdfplumber#visual-debugging)\n",{"mcp":24,"name":5,"tags":29,"author":34,"models":35,"license":15,"version":43,"category":30,"languages":44,"department":47,"description":7,"capabilities":48},{"tools":25,"server":28},[26,27],"extract_text_from_pdf","extract_tables_from_pdf","office-mcp",[30,31,32,33],"pdf","extraction","text","tables","claude-office-skills",{"compatible":36,"recommended":40},[37,38,39],"claude-3-5-sonnet","gpt-4","gpt-4o",[41,42],"claude-sonnet-4","claude-opus-4","1.0",[45,46],"en","zh","All",[49,50,51],"text_extraction","table_extraction","data_mining","main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-extraction",1,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper","https:\u002F\u002Fgithub.com\u002Fom-scogo","SDE-1 @ Scogo ","2026-07-18 12:22:46",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill pdf-extraction",{"tool":66,"command":67},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill pdf-extraction",{"tool":69,"command":70},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill pdf-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-extraction\u002FSkill.md",true,[74],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"metadata.json","REFERENCE","参考文档",476,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-extraction\u002Fmetadata.json",[81,88,93,100,105,112],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7D6MC9FAAEV4CMNYX8W7JTG","arxiv-search","Search arXiv physics, math, and computer science preprints using natural language queries. Powered by Valyu semantic search.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002Fskills\u002Farxiv-search\u002FSKILL.md",[],[],{"skillNo":89,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7D4ZTCS4DR3CE4JY06X84T2","working-with-legacy-code","Safely change and test untested codebases using Feathers' \"Working Effectively with Legacy Code\". Use when the user mentions \"legacy code\", \"no tests\", \"untested codebase\", \"how do I test this\", \"seams\", \"characterization tests\", \"golden master\", \"sprout method\", \"afraid to change this code\", \"monster method\", \"dependency breaking\", or \"inherited a messy codebase\". Also trigger when changing code without tests safely, getting a class under test when constructors, statics, or singletons block it, adding features to tangled modules, or planning incremental test coverage for an old codebase. Covers the legacy-code change algorithm, seams, characterization tests, sprout\u002Fwrap, and dependency-breaking techniques. For refactoring code that already has tests, see refactoring-patterns. For day-to-day code quality, see clean-code.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002Fworking-with-legacy-code\u002FSKILL.md",[],[],{"skillNo":101,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M7D4ZB4CJBFW5JE67CPH2QRV","web-typography","Select, pair, and implement typefaces for web projects. Use when the user mentions \"font pairing\", \"which typeface\", \"line height\", \"responsive typography\", \"web font loading\", \"type hierarchy\", \"variable fonts\", \"FOUT\u002FFOIT\", \"typographic scale\", or \"the text is hard to read\". Also trigger when choosing between system fonts and web fonts, optimizing font-loading performance, or designing readable long-form content. Covers readability evaluation, CSS implementation, and performance optimization. For overall UI design systems, see refactoring-ui. For dramatic typographic experiences, see top-design.","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002Fweb-typography\u002FSKILL.md",[],[],{"skillNo":113,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]