[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75ANB4NGRT9EG1NWMHBS2TA":3,"skill-same:01M75ANB4NGRT9EG1NWMHBS2TA":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":13,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M75ANB4NGRT9EG1NWMHBS2TA","pdf-extraction",null,"Extract text, tables, and metadata from PDFs using pdfplumber","CrazyLichen\u002Fuapclaw-go","CrazyLichen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F258162500?v=4","01M75AJR4RBD9PQ6SYKFRQJTQY","01M75AJR5GF7DGJ0YB0W7QD764",0,"MIT","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fpdf-extraction\u002FSKILL.md",[],[],"2026-11-12 13:55:43",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":23,"name":5,"tags":28,"author":33,"models":34,"license":14,"version":42,"category":29,"languages":43,"department":46,"description":7,"capabilities":47},{"tools":24,"server":27},[25,26],"extract_text_from_pdf","extract_tables_from_pdf","office-mcp",[29,30,31,32],"pdf","extraction","text","tables","claude-office-skills",{"compatible":35,"recommended":39},[36,37,38],"claude-3-5-sonnet","gpt-4","gpt-4o",[40,41],"claude-sonnet-4","claude-opus-4","1.0",[44,45],"en","zh","All",[48,49,50],"text_extraction","table_extraction","data_mining","main","31c68f1194edc9b01244fb269a0e25011560dc88","resources\u002Fagent\u002Fworkspace\u002Fskills\u002Fpdf-extraction","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go","https:\u002F\u002Fgithub.com\u002FCrazyLichen","2026-11-15 03:12:37",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add CrazyLichen\u002Fuapclaw-go --skill pdf-extraction",{"tool":63,"command":64},"bunx","bunx skills add CrazyLichen\u002Fuapclaw-go --skill pdf-extraction",{"tool":66,"command":67},"pnpm","pnpm dlx skills add CrazyLichen\u002Fuapclaw-go --skill pdf-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fpdf-extraction\u002FSKILL.md",true,[],[72,79,88,95,102],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75AQ5W7CMFGQJ3VJ79TPKKA","xlsx","Open, create, read, analyze, edit, repair, or validate spreadsheet files (.xlsx, .xlsm, .xltx, .csv, .tsv) with zero format loss, with first-class support for Chinese \u002F CJK content. Use whenever the user asks to create, build, modify, fill, analyze, read, repair, validate, or format any spreadsheet, workbook, report, dashboard, budget, financial model, pivot table, or tabular data file. Handles Chinese text, encodings (UTF-8 \u002F GB18030 \u002F GBK), full-width characters, CJK fonts in rendering, and Chinese number\u002Fdate conventions (¥, 万\u002F亿, 年\u002F月\u002F日). Covers: creating new workbooks from scratch, reading and analyzing existing files, editing existing workbooks while preserving pivot tables \u002F VBA macros \u002F charts \u002F sparklines \u002F conditional formatting \u002F named ranges, formula recalculation and validation, visual review of results, and applying professional formatting. Triggers on 'spreadsheet', 'Excel', 'workbook', '表格', '工作簿', '.xlsx', '.xlsm', '.csv', 'pivot table', '透视表', 'macro', '宏', 'chart', '图表', 'financial model', '财务模型', 'formula', '公式', or any request to produce tabular data.","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":83,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M75AP0E43VCJKRBYT11TB3NW","skill-creator-normal","Create new single-agent skills, modify and improve existing single-agent skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fskill-creator-normal\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fskill-creator-normal\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M75ANRD007FV2GH4KJFSWAFK","project-maintainer","Use when initializing or updating structured in-repository project-maintenance docs; exploring existing code; analyzing a full project or repository; documenting complete source symbol coverage, coverage maps, symbol audit maps, or health for every top-level class, top-level function, and class method; summarizing git history; using project-maintainer as maintenance-aware context during a bug fix, feature change, or refactor; or syncing docs after verified code changes.","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fproject-maintainer\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M75ANMJSCDHNWW4AQS0CM880","pptx-generator","Generate, edit, and read PowerPoint presentations. Create from scratch with PptxGenJS (cover, TOC, content, section divider, summary slides), edit existing PPTX via XML workflows, or extract text with markitdown. Triggers: PPT, PPTX, PowerPoint, presentation, slide, deck, slides.","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Fpptx-generator\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":18},"01M75AN4AX3APH84GYJKNKR2QR","local-doc-ocr","本地离线 OCR——将扫描件 PDF\u002F图片提取为文字。双引擎：(A) RapidOCR 纯本地离线一键出 .md（默认保底、不联网、不占 token、可批量）；(B) 支持多模态读图能力的 Agent 逐页读图（高质量，擅长表格\u002F手写\u002F印章，如 WorkBuddy 的 Read 工具）。全程本机处理，适合涉密\u002F敏感与隐私资料。触发词：OCR、识别、读PDF、读一下这份、把这个读出来、转成文字、扫描件提取、图片转文字、识别扫描件、PDF转文字、手写识别、提取图片里的字、这份文件读不出来、资料入库（如喂给知识库）时遇到扫描件。注：用户说\"识别隐患\u002F安全隐患\"属安全检查类技能，本技能只做文字提取。","https:\u002F\u002Fgithub.com\u002FCrazyLichen\u002Fuapclaw-go\u002Fblob\u002Fmain\u002Fresources\u002Fagent\u002Fworkspace\u002Fskills\u002Flocal-doc-ocr\u002FSKILL.md",[],[]]