[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78ECP93Y9AR0PR4844CQYYJ":3,"skill-same:01M78ECP93Y9AR0PR4844CQYYJ":73},{"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":6,"updatedAt":58,"install":59,"resources":72},"01M78ECP93Y9AR0PR4844CQYYJ","pdf-extraction",null,"Extract text, tables, and metadata from PDFs using pdfplumber","TunoC2C\u002Fworkbuddy-experts","TunoC2C","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F225868569?v=4","01M78D8HMM5G9V9QXAKDN8HKBG","AllbetMarket","01M78D8HN8G263P7TKFAWAVBFY",1,"MIT","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fcpq\u002Fskills\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","f4f4c3476fefc4a8eacb35c8560b20961fa760f6","plugins\u002Fcpq\u002Fskills\u002Fpdf-extraction",0,"https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts","https:\u002F\u002Fgithub.com\u002FTunoC2C","2026-07-14 12:16:15",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add TunoC2C\u002Fworkbuddy-experts --skill pdf-extraction",{"tool":65,"command":66},"bunx","bunx skills add TunoC2C\u002Fworkbuddy-experts --skill pdf-extraction",{"tool":68,"command":69},"pnpm","pnpm dlx skills add TunoC2C\u002Fworkbuddy-experts --skill pdf-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fcpq\u002Fskills\u002Fpdf-extraction\u002FSKILL.md",true,[],[74,82,89,98,104,110],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":78,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M78HXPB2R7WQPMTTQABZK0D9","minimax-docx","Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: (A) create new documents from scratch, (B) fill\u002Fedit content in existing documents, (C) apply template formatting with XSD validation gate-check. MUST use this skill whenever the user wants to produce, modify, or format a Word document — including when they say \"write a report\", \"draft a proposal\", \"make a contract\", \"fill in this form\", \"reformat to match this template\", or any task whose final output is a .docx file. Even if the user doesn't mention \"docx\" explicitly, if the task implies a printable\u002Fformal document, use this skill.","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fworkflow-optimization-expert\u002Fskills\u002Fminimax-docx\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fworkflow-optimization-expert\u002Fskills\u002Fminimax-docx\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M78HSYJE1GSX23R0VSPTQ2VZ","fullstack-dev","Full-stack backend architecture and frontend-backend integration guide.\nTRIGGER when: building a full-stack app, creating REST API with frontend, scaffolding backend service,\nbuilding todo app, building CRUD app, building real-time app, building chat app,\nExpress + React, Next.js API, Node.js backend, Python backend, Go backend,\ndesigning service layers, implementing error handling, managing config\u002Fauth,\nsetting up API clients, implementing auth flows, handling file uploads,\nadding real-time features (SSE\u002FWebSocket), hardening for production.\nDO NOT TRIGGER when: pure frontend UI work, pure CSS\u002Fstyling, database schema only.","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fwe-chat-mini-program-developer\u002Fskills\u002Ffullstack-dev\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":93,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M78HST90YG1TSRTQZCR544SB","brand-guidelines","Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fwe-chat-mini-program-developer\u002Fskills\u002Fbrand-guidelines\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fwe-chat-mini-program-developer\u002Fskills\u002Fbrand-guidelines\u002FSKILL.md",[],[],{"skillNo":99,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M78HSHADE77ECYFWRP155WBW","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fvisual-storytelling-expert\u002Fskills\u002Fminimax-docx\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fvisual-storytelling-expert\u002Fskills\u002Fminimax-docx\u002FSKILL.md",[],[],{"skillNo":105,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M78HMJ4ZQBAT52555JMVKT0Z","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fuser-experience-researcher\u002Fskills\u002Fminimax-docx\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Fuser-experience-researcher\u002Fskills\u002Fminimax-docx\u002FSKILL.md",[],[],{"skillNo":111,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M78HM0DMR5YK9CAW6W2D3SJS","https:\u002F\u002Fgithub.com\u002FTunoC2C\u002Fworkbuddy-experts\u002Fblob\u002Fmain\u002Fplugins\u002Funity-editor-tool-developer\u002Fskills\u002Ffullstack-dev\u002FSKILL.md",[],[]]