[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BW1CYVMH52BK6C8Z2JJD71":3,"skill-same:01M7BW1CYVMH52BK6C8Z2JJD71":77},{"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":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M7BW1CYVMH52BK6C8Z2JJD71","pdf-to-docx",null,"Convert PDF files to editable Word documents using pdf2docx","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-to-docx\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-to-docx\ndescription: \"Convert PDF files to editable Word documents using pdf2docx\"\nversion: \"1.0\"\nauthor: claude-office-skills\nlicense: MIT\n\n# Categorization\ncategory: pdf\ntags:\n  - pdf\n  - docx\n  - conversion\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    - pdf_to_docx\n\n# Skill Capabilities\ncapabilities:\n  - format_conversion\n  - editable_documents\n\n# Language Support\nlanguages:\n  - en\n  - zh\n---\n\n# PDF to Word Skill\n\n## Overview\n\nThis skill enables conversion from PDF to editable Word documents using **pdf2docx** - a Python library that preserves layout, tables, images, and text formatting. Unlike OCR-based solutions, pdf2docx extracts native PDF content for accurate conversion.\n\n## How to Use\n\n1. Provide the PDF file you want to convert\n2. Optionally specify pages or conversion options\n3. I'll convert it to an editable Word document\n\n**Example prompts:**\n- \"Convert this PDF report to an editable Word document\"\n- \"Turn pages 1-5 of this PDF into Word format\"\n- \"Extract this scanned document as editable text\"\n- \"Convert this PDF contract to Word for editing\"\n\n## Domain Knowledge\n\n### pdf2docx Fundamentals\n\n```python\nfrom pdf2docx import Converter\n\n# Basic conversion\ncv = Converter('input.pdf')\ncv.convert('output.docx')\ncv.close()\n\n# Or using context manager\nwith Converter('input.pdf') as cv:\n    cv.convert('output.docx')\n```\n\n### Conversion Options\n\n```python\nfrom pdf2docx import Converter\n\ncv = Converter('input.pdf')\n\n# Full document\ncv.convert('output.docx')\n\n# Specific pages (0-indexed)\ncv.convert('output.docx', start=0, end=5)\n\n# Single page\ncv.convert('output.docx', pages=[0])\n\n# Multiple specific pages\ncv.convert('output.docx', pages=[0, 2, 4])\n\ncv.close()\n```\n\n### Advanced Options\n\n```python\nfrom pdf2docx import Converter\n\ncv = Converter('input.pdf')\n\ncv.convert(\n    'output.docx',\n    start=0,                    # Start page (0-indexed)\n    end=None,                   # End page (None = last page)\n    pages=None,                 # Specific pages list\n    password=None,              # PDF password if encrypted\n    min_section_height=20.0,    # Minimum height for section\n    connected_border_tolerance=0.5,  # Border detection tolerance\n    line_overlap_threshold=0.9, # Line merging threshold\n    line_break_width_ratio=0.5, # Line break detection\n    line_break_free_space_ratio=0.1,\n    line_separate_threshold=5,  # Vertical line separation\n    new_paragraph_free_space_ratio=0.85,\n    float_image_ignorable_gap=5,\n    page_margin_factor_top=0.5,\n    page_margin_factor_bottom=0.5,\n)\n\ncv.close()\n```\n\n### Handling Different PDF Types\n\n#### Native PDFs (Text-based)\n```python\n# Works best with native PDFs\ncv = Converter('native_pdf.pdf')\ncv.convert('output.docx')\ncv.close()\n```\n\n#### Scanned PDFs (Image-based)\n```python\n# For scanned PDFs, use OCR first\n# pdf2docx works best with native text PDFs\n# Consider using pytesseract or PaddleOCR first\n\nimport pytesseract\nfrom pdf2image import convert_from_path\n\n# Convert PDF pages to images\nimages = convert_from_path('scanned.pdf')\n\n# OCR each page\ntext = ''\nfor img in images:\n    text += pytesseract.image_to_string(img)\n\n# Then create Word document from text\n```\n\n### Python Integration\n\n```python\nfrom pdf2docx import Converter\nimport os\n\ndef pdf_to_word(pdf_path, output_path=None, pages=None):\n    \"\"\"Convert PDF to Word document.\"\"\"\n    if output_path is None:\n        output_path = pdf_path.replace('.pdf', '.docx')\n    \n    cv = Converter(pdf_path)\n    \n    if pages:\n        cv.convert(output_path, pages=pages)\n    else:\n        cv.convert(output_path)\n    \n    cv.close()\n    \n    return output_path\n\n# Usage\nresult = pdf_to_word('document.pdf')\nprint(f\"Created: {result}\")\n```\n\n### Batch Conversion\n\n```python\nfrom pdf2docx import Converter\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor\n\ndef convert_single(pdf_path, output_dir):\n    \"\"\"Convert single PDF to Word.\"\"\"\n    output_path = output_dir \u002F pdf_path.with_suffix('.docx').name\n    \n    try:\n        cv = Converter(str(pdf_path))\n        cv.convert(str(output_path))\n        cv.close()\n        return f\"Success: {pdf_path.name}\"\n    except Exception as e:\n        return f\"Error: {pdf_path.name} - {e}\"\n\ndef batch_convert(input_dir, output_dir, max_workers=4):\n    \"\"\"Convert all PDFs in directory.\"\"\"\n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    pdf_files = list(input_path.glob('*.pdf'))\n    \n    with ThreadPoolExecutor(max_workers=max_workers) as executor:\n        futures = [\n            executor.submit(convert_single, pdf, output_path)\n            for pdf in pdf_files\n        ]\n        \n        for future in futures:\n            print(future.result())\n\nbatch_convert('.\u002Fpdfs', '.\u002Fword_docs')\n```\n\n### Parsing PDF Structure\n\n```python\nfrom pdf2docx import Converter\n\ndef analyze_pdf(pdf_path):\n    \"\"\"Analyze PDF structure before conversion.\"\"\"\n    cv = Converter(pdf_path)\n    \n    for i, page in enumerate(cv.pages):\n        print(f\"Page {i+1}:\")\n        print(f\"  Size: {page.width} x {page.height}\")\n        print(f\"  Blocks: {len(page.blocks)}\")\n        \n        for block in page.blocks:\n            if hasattr(block, 'text'):\n                print(f\"    Text block: {block.text[:50]}...\")\n            elif hasattr(block, 'image'):\n                print(f\"    Image block\")\n    \n    cv.close()\n\nanalyze_pdf('document.pdf')\n```\n\n## Best Practices\n\n1. **Check PDF Type**: Native PDFs convert better than scanned\n2. **Preview First**: Test with a few pages before full conversion\n3. **Handle Tables**: Complex tables may need manual adjustment\n4. **Image Quality**: Images are extracted at original resolution\n5. **Font Handling**: Some fonts may substitute to system defaults\n\n## Common Patterns\n\n### Convert with Progress\n```python\nfrom pdf2docx import Converter\n\ndef convert_with_progress(pdf_path, output_path):\n    \"\"\"Convert PDF with progress tracking.\"\"\"\n    cv = Converter(pdf_path)\n    \n    total_pages = len(cv.pages)\n    print(f\"Converting {total_pages} pages...\")\n    \n    for i in range(total_pages):\n        cv.convert(output_path, start=i, end=i+1)\n        progress = (i + 1) \u002F total_pages * 100\n        print(f\"Progress: {progress:.1f}%\")\n    \n    cv.close()\n    print(\"Conversion complete!\")\n```\n\n### Extract Tables Only\n```python\nfrom pdf2docx import Converter\nfrom docx import Document\n\ndef extract_tables_to_word(pdf_path, output_path):\n    \"\"\"Extract only tables from PDF to Word.\"\"\"\n    cv = Converter(pdf_path)\n    \n    # First do full conversion\n    temp_path = 'temp_full.docx'\n    cv.convert(temp_path)\n    cv.close()\n    \n    # Open and extract tables\n    doc = Document(temp_path)\n    new_doc = Document()\n    \n    for table in doc.tables:\n        # Copy table to new document\n        new_table = new_doc.add_table(rows=0, cols=len(table.columns))\n        \n        for row in table.rows:\n            new_row = new_table.add_row()\n            for i, cell in enumerate(row.cells):\n                new_row.cells[i].text = cell.text\n        \n        new_doc.add_paragraph()  # Add spacing\n    \n    new_doc.save(output_path)\n    os.remove(temp_path)\n```\n\n## Examples\n\n### Example 1: Contract Conversion\n```python\nfrom pdf2docx import Converter\nimport os\n\ndef convert_contract(pdf_path):\n    \"\"\"Convert contract PDF to editable Word with metadata.\"\"\"\n    \n    # Define output path\n    base_name = os.path.splitext(pdf_path)[0]\n    output_path = f\"{base_name}_editable.docx\"\n    \n    # Convert\n    cv = Converter(pdf_path)\n    \n    # Check page count\n    page_count = len(cv.pages)\n    print(f\"Processing {page_count} pages...\")\n    \n    # Convert all pages\n    cv.convert(output_path)\n    cv.close()\n    \n    print(f\"Created: {output_path}\")\n    print(f\"File size: {os.path.getsize(output_path) \u002F 1024:.1f} KB\")\n    \n    return output_path\n\n# Usage\nresult = convert_contract('contract.pdf')\n```\n\n### Example 2: Selective Page Conversion\n```python\nfrom pdf2docx import Converter\n\ndef convert_selected_pages(pdf_path, page_ranges, output_path):\n    \"\"\"Convert specific page ranges to Word.\n    \n    page_ranges: List of tuples like [(1, 3), (5, 7)] for pages 1-3 and 5-7\n    \"\"\"\n    cv = Converter(pdf_path)\n    \n    # Convert pages (0-indexed internally)\n    all_pages = []\n    for start, end in page_ranges:\n        all_pages.extend(range(start - 1, end))  # Convert to 0-indexed\n    \n    cv.convert(output_path, pages=all_pages)\n    cv.close()\n    \n    print(f\"Converted pages: {page_ranges}\")\n    return output_path\n\n# Convert pages 1-5 and 10-15\nconvert_selected_pages(\n    'long_document.pdf',\n    [(1, 5), (10, 15)],\n    'selected_pages.docx'\n)\n```\n\n### Example 3: PDF Report to Editable Template\n```python\nfrom pdf2docx import Converter\nfrom docx import Document\n\ndef pdf_to_template(pdf_path, output_path):\n    \"\"\"Convert PDF report to Word template with placeholders.\"\"\"\n    \n    # Convert PDF to Word\n    cv = Converter(pdf_path)\n    cv.convert(output_path)\n    cv.close()\n    \n    # Open and add placeholder fields\n    doc = Document(output_path)\n    \n    # Replace common fields with placeholders\n    replacements = {\n        'Company Name': '[COMPANY_NAME]',\n        'Date:': 'Date: [DATE]',\n        'Prepared by:': 'Prepared by: [AUTHOR]',\n    }\n    \n    for para in doc.paragraphs:\n        for old, new in replacements.items():\n            if old in para.text:\n                para.text = para.text.replace(old, new)\n    \n    # Also check tables\n    for table in doc.tables:\n        for row in table.rows:\n            for cell in row.cells:\n                for old, new in replacements.items():\n                    if old in cell.text:\n                        cell.text = cell.text.replace(old, new)\n    \n    doc.save(output_path)\n    print(f\"Template created: {output_path}\")\n\npdf_to_template('annual_report.pdf', 'report_template.docx')\n```\n\n### Example 4: Bulk Invoice Processing\n```python\nfrom pdf2docx import Converter\nfrom pathlib import Path\nimport json\n\ndef process_invoices(input_folder, output_folder):\n    \"\"\"Convert PDF invoices to editable Word documents.\"\"\"\n    \n    input_path = Path(input_folder)\n    output_path = Path(output_folder)\n    output_path.mkdir(exist_ok=True)\n    \n    results = []\n    \n    for pdf_file in input_path.glob('*.pdf'):\n        output_file = output_path \u002F pdf_file.with_suffix('.docx').name\n        \n        try:\n            cv = Converter(str(pdf_file))\n            cv.convert(str(output_file))\n            cv.close()\n            \n            results.append({\n                'file': pdf_file.name,\n                'status': 'success',\n                'output': str(output_file)\n            })\n            \n        except Exception as e:\n            results.append({\n                'file': pdf_file.name,\n                'status': 'error',\n                'error': str(e)\n            })\n    \n    # Save results log\n    with open(output_path \u002F 'conversion_log.json', 'w') as f:\n        json.dump(results, f, indent=2)\n    \n    # Summary\n    success = sum(1 for r in results if r['status'] == 'success')\n    print(f\"Converted {success}\u002F{len(results)} files\")\n    \n    return results\n\nresults = process_invoices('.\u002Finvoices_pdf', '.\u002Finvoices_word')\n```\n\n## Limitations\n\n- Scanned PDFs require OCR preprocessing\n- Complex layouts may not convert perfectly\n- Some fonts may not be available\n- Watermarks are included in conversion\n- Protected\u002Fencrypted PDFs need password\n\n## Installation\n\n```bash\npip install pdf2docx\n\n# For image handling\npip install Pillow\n```\n\n## Resources\n\n- [GitHub Repository](https:\u002F\u002Fgithub.com\u002Fdothinking\u002Fpdf2docx)\n- [Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [PyPI Package](https:\u002F\u002Fpypi.org\u002Fproject\u002Fpdf2docx\u002F)\n","# PDF to Word Skill\n\n## Overview\n\nThis skill enables conversion from PDF to editable Word documents using **pdf2docx** - a Python library that preserves layout, tables, images, and text formatting. Unlike OCR-based solutions, pdf2docx extracts native PDF content for accurate conversion.\n\n## How to Use\n\n1. Provide the PDF file you want to convert\n2. Optionally specify pages or conversion options\n3. I'll convert it to an editable Word document\n\n**Example prompts:**\n- \"Convert this PDF report to an editable Word document\"\n- \"Turn pages 1-5 of this PDF into Word format\"\n- \"Extract this scanned document as editable text\"\n- \"Convert this PDF contract to Word for editing\"\n\n## Domain Knowledge\n\n### pdf2docx Fundamentals\n\n```python\nfrom pdf2docx import Converter\n\n# Basic conversion\ncv = Converter('input.pdf')\ncv.convert('output.docx')\ncv.close()\n\n# Or using context manager\nwith Converter('input.pdf') as cv:\n    cv.convert('output.docx')\n```\n\n### Conversion Options\n\n```python\nfrom pdf2docx import Converter\n\ncv = Converter('input.pdf')\n\n# Full document\ncv.convert('output.docx')\n\n# Specific pages (0-indexed)\ncv.convert('output.docx', start=0, end=5)\n\n# Single page\ncv.convert('output.docx', pages=[0])\n\n# Multiple specific pages\ncv.convert('output.docx', pages=[0, 2, 4])\n\ncv.close()\n```\n\n### Advanced Options\n\n```python\nfrom pdf2docx import Converter\n\ncv = Converter('input.pdf')\n\ncv.convert(\n    'output.docx',\n    start=0,                    # Start page (0-indexed)\n    end=None,                   # End page (None = last page)\n    pages=None,                 # Specific pages list\n    password=None,              # PDF password if encrypted\n    min_section_height=20.0,    # Minimum height for section\n    connected_border_tolerance=0.5,  # Border detection tolerance\n    line_overlap_threshold=0.9, # Line merging threshold\n    line_break_width_ratio=0.5, # Line break detection\n    line_break_free_space_ratio=0.1,\n    line_separate_threshold=5,  # Vertical line separation\n    new_paragraph_free_space_ratio=0.85,\n    float_image_ignorable_gap=5,\n    page_margin_factor_top=0.5,\n    page_margin_factor_bottom=0.5,\n)\n\ncv.close()\n```\n\n### Handling Different PDF Types\n\n#### Native PDFs (Text-based)\n```python\n# Works best with native PDFs\ncv = Converter('native_pdf.pdf')\ncv.convert('output.docx')\ncv.close()\n```\n\n#### Scanned PDFs (Image-based)\n```python\n# For scanned PDFs, use OCR first\n# pdf2docx works best with native text PDFs\n# Consider using pytesseract or PaddleOCR first\n\nimport pytesseract\nfrom pdf2image import convert_from_path\n\n# Convert PDF pages to images\nimages = convert_from_path('scanned.pdf')\n\n# OCR each page\ntext = ''\nfor img in images:\n    text += pytesseract.image_to_string(img)\n\n# Then create Word document from text\n```\n\n### Python Integration\n\n```python\nfrom pdf2docx import Converter\nimport os\n\ndef pdf_to_word(pdf_path, output_path=None, pages=None):\n    \"\"\"Convert PDF to Word document.\"\"\"\n    if output_path is None:\n        output_path = pdf_path.replace('.pdf', '.docx')\n    \n    cv = Converter(pdf_path)\n    \n    if pages:\n        cv.convert(output_path, pages=pages)\n    else:\n        cv.convert(output_path)\n    \n    cv.close()\n    \n    return output_path\n\n# Usage\nresult = pdf_to_word('document.pdf')\nprint(f\"Created: {result}\")\n```\n\n### Batch Conversion\n\n```python\nfrom pdf2docx import Converter\nfrom pathlib import Path\nfrom concurrent.futures import ThreadPoolExecutor\n\ndef convert_single(pdf_path, output_dir):\n    \"\"\"Convert single PDF to Word.\"\"\"\n    output_path = output_dir \u002F pdf_path.with_suffix('.docx').name\n    \n    try:\n        cv = Converter(str(pdf_path))\n        cv.convert(str(output_path))\n        cv.close()\n        return f\"Success: {pdf_path.name}\"\n    except Exception as e:\n        return f\"Error: {pdf_path.name} - {e}\"\n\ndef batch_convert(input_dir, output_dir, max_workers=4):\n    \"\"\"Convert all PDFs in directory.\"\"\"\n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    pdf_files = list(input_path.glob('*.pdf'))\n    \n    with ThreadPoolExecutor(max_workers=max_workers) as executor:\n        futures = [\n            executor.submit(convert_single, pdf, output_path)\n            for pdf in pdf_files\n        ]\n        \n        for future in futures:\n            print(future.result())\n\nbatch_convert('.\u002Fpdfs', '.\u002Fword_docs')\n```\n\n### Parsing PDF Structure\n\n```python\nfrom pdf2docx import Converter\n\ndef analyze_pdf(pdf_path):\n    \"\"\"Analyze PDF structure before conversion.\"\"\"\n    cv = Converter(pdf_path)\n    \n    for i, page in enumerate(cv.pages):\n        print(f\"Page {i+1}:\")\n        print(f\"  Size: {page.width} x {page.height}\")\n        print(f\"  Blocks: {len(page.blocks)}\")\n        \n        for block in page.blocks:\n            if hasattr(block, 'text'):\n                print(f\"    Text block: {block.text[:50]}...\")\n            elif hasattr(block, 'image'):\n                print(f\"    Image block\")\n    \n    cv.close()\n\nanalyze_pdf('document.pdf')\n```\n\n## Best Practices\n\n1. **Check PDF Type**: Native PDFs convert better than scanned\n2. **Preview First**: Test with a few pages before full conversion\n3. **Handle Tables**: Complex tables may need manual adjustment\n4. **Image Quality**: Images are extracted at original resolution\n5. **Font Handling**: Some fonts may substitute to system defaults\n\n## Common Patterns\n\n### Convert with Progress\n```python\nfrom pdf2docx import Converter\n\ndef convert_with_progress(pdf_path, output_path):\n    \"\"\"Convert PDF with progress tracking.\"\"\"\n    cv = Converter(pdf_path)\n    \n    total_pages = len(cv.pages)\n    print(f\"Converting {total_pages} pages...\")\n    \n    for i in range(total_pages):\n        cv.convert(output_path, start=i, end=i+1)\n        progress = (i + 1) \u002F total_pages * 100\n        print(f\"Progress: {progress:.1f}%\")\n    \n    cv.close()\n    print(\"Conversion complete!\")\n```\n\n### Extract Tables Only\n```python\nfrom pdf2docx import Converter\nfrom docx import Document\n\ndef extract_tables_to_word(pdf_path, output_path):\n    \"\"\"Extract only tables from PDF to Word.\"\"\"\n    cv = Converter(pdf_path)\n    \n    # First do full conversion\n    temp_path = 'temp_full.docx'\n    cv.convert(temp_path)\n    cv.close()\n    \n    # Open and extract tables\n    doc = Document(temp_path)\n    new_doc = Document()\n    \n    for table in doc.tables:\n        # Copy table to new document\n        new_table = new_doc.add_table(rows=0, cols=len(table.columns))\n        \n        for row in table.rows:\n            new_row = new_table.add_row()\n            for i, cell in enumerate(row.cells):\n                new_row.cells[i].text = cell.text\n        \n        new_doc.add_paragraph()  # Add spacing\n    \n    new_doc.save(output_path)\n    os.remove(temp_path)\n```\n\n## Examples\n\n### Example 1: Contract Conversion\n```python\nfrom pdf2docx import Converter\nimport os\n\ndef convert_contract(pdf_path):\n    \"\"\"Convert contract PDF to editable Word with metadata.\"\"\"\n    \n    # Define output path\n    base_name = os.path.splitext(pdf_path)[0]\n    output_path = f\"{base_name}_editable.docx\"\n    \n    # Convert\n    cv = Converter(pdf_path)\n    \n    # Check page count\n    page_count = len(cv.pages)\n    print(f\"Processing {page_count} pages...\")\n    \n    # Convert all pages\n    cv.convert(output_path)\n    cv.close()\n    \n    print(f\"Created: {output_path}\")\n    print(f\"File size: {os.path.getsize(output_path) \u002F 1024:.1f} KB\")\n    \n    return output_path\n\n# Usage\nresult = convert_contract('contract.pdf')\n```\n\n### Example 2: Selective Page Conversion\n```python\nfrom pdf2docx import Converter\n\ndef convert_selected_pages(pdf_path, page_ranges, output_path):\n    \"\"\"Convert specific page ranges to Word.\n    \n    page_ranges: List of tuples like [(1, 3), (5, 7)] for pages 1-3 and 5-7\n    \"\"\"\n    cv = Converter(pdf_path)\n    \n    # Convert pages (0-indexed internally)\n    all_pages = []\n    for start, end in page_ranges:\n        all_pages.extend(range(start - 1, end))  # Convert to 0-indexed\n    \n    cv.convert(output_path, pages=all_pages)\n    cv.close()\n    \n    print(f\"Converted pages: {page_ranges}\")\n    return output_path\n\n# Convert pages 1-5 and 10-15\nconvert_selected_pages(\n    'long_document.pdf',\n    [(1, 5), (10, 15)],\n    'selected_pages.docx'\n)\n```\n\n### Example 3: PDF Report to Editable Template\n```python\nfrom pdf2docx import Converter\nfrom docx import Document\n\ndef pdf_to_template(pdf_path, output_path):\n    \"\"\"Convert PDF report to Word template with placeholders.\"\"\"\n    \n    # Convert PDF to Word\n    cv = Converter(pdf_path)\n    cv.convert(output_path)\n    cv.close()\n    \n    # Open and add placeholder fields\n    doc = Document(output_path)\n    \n    # Replace common fields with placeholders\n    replacements = {\n        'Company Name': '[COMPANY_NAME]',\n        'Date:': 'Date: [DATE]',\n        'Prepared by:': 'Prepared by: [AUTHOR]',\n    }\n    \n    for para in doc.paragraphs:\n        for old, new in replacements.items():\n            if old in para.text:\n                para.text = para.text.replace(old, new)\n    \n    # Also check tables\n    for table in doc.tables:\n        for row in table.rows:\n            for cell in row.cells:\n                for old, new in replacements.items():\n                    if old in cell.text:\n                        cell.text = cell.text.replace(old, new)\n    \n    doc.save(output_path)\n    print(f\"Template created: {output_path}\")\n\npdf_to_template('annual_report.pdf', 'report_template.docx')\n```\n\n### Example 4: Bulk Invoice Processing\n```python\nfrom pdf2docx import Converter\nfrom pathlib import Path\nimport json\n\ndef process_invoices(input_folder, output_folder):\n    \"\"\"Convert PDF invoices to editable Word documents.\"\"\"\n    \n    input_path = Path(input_folder)\n    output_path = Path(output_folder)\n    output_path.mkdir(exist_ok=True)\n    \n    results = []\n    \n    for pdf_file in input_path.glob('*.pdf'):\n        output_file = output_path \u002F pdf_file.with_suffix('.docx').name\n        \n        try:\n            cv = Converter(str(pdf_file))\n            cv.convert(str(output_file))\n            cv.close()\n            \n            results.append({\n                'file': pdf_file.name,\n                'status': 'success',\n                'output': str(output_file)\n            })\n            \n        except Exception as e:\n            results.append({\n                'file': pdf_file.name,\n                'status': 'error',\n                'error': str(e)\n            })\n    \n    # Save results log\n    with open(output_path \u002F 'conversion_log.json', 'w') as f:\n        json.dump(results, f, indent=2)\n    \n    # Summary\n    success = sum(1 for r in results if r['status'] == 'success')\n    print(f\"Converted {success}\u002F{len(results)} files\")\n    \n    return results\n\nresults = process_invoices('.\u002Finvoices_pdf', '.\u002Finvoices_word')\n```\n\n## Limitations\n\n- Scanned PDFs require OCR preprocessing\n- Complex layouts may not convert perfectly\n- Some fonts may not be available\n- Watermarks are included in conversion\n- Protected\u002Fencrypted PDFs need password\n\n## Installation\n\n```bash\npip install pdf2docx\n\n# For image handling\npip install Pillow\n```\n\n## Resources\n\n- [GitHub Repository](https:\u002F\u002Fgithub.com\u002Fdothinking\u002Fpdf2docx)\n- [Documentation](https:\u002F\u002Fpdf2docx.readthedocs.io\u002F)\n- [PyPI Package](https:\u002F\u002Fpypi.org\u002Fproject\u002Fpdf2docx\u002F)\n",{"mcp":24,"name":5,"tags":28,"author":32,"models":33,"license":15,"version":41,"category":29,"languages":42,"department":45,"description":7,"capabilities":46},{"tools":25,"server":27},[26],"pdf_to_docx","office-mcp",[29,30,31],"pdf","docx","conversion","claude-office-skills",{"compatible":34,"recommended":38},[35,36,37],"claude-3-5-sonnet","gpt-4","gpt-4o",[39,40],"claude-sonnet-4","claude-opus-4","1.0",[43,44],"en","zh","All",[47,48],"format_conversion","editable_documents","main","8859218955d9504cd18b59e7892100718039d3b4","data\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-to-docx",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":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add om-scogo\u002Fskillsh-scraper --skill pdf-to-docx",{"tool":63,"command":64},"bunx","bunx skills add om-scogo\u002Fskillsh-scraper --skill pdf-to-docx",{"tool":66,"command":67},"pnpm","pnpm dlx skills add om-scogo\u002Fskillsh-scraper --skill pdf-to-docx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-to-docx\u002FSkill.md",true,[71],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"metadata.json","REFERENCE","参考文档",464,"https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fclaude-office-skills-skills\u002Fpdf-to-docx\u002Fmetadata.json",[78,85,90,97,102,109],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"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":86,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7D6M85CKKN87TA98VCQV4H7","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fyorkeccak-scientific-skills\u002Farxiv-search\u002FSkill.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"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":98,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7D4ZHZKJD2RSNGAF63V14P4","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fworking-with-legacy-code\u002FSkill.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"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":110,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7D4Z4MVYVY3NMJ18BNV6WNA","https:\u002F\u002Fgithub.com\u002Fom-scogo\u002Fskillsh-scraper\u002Fblob\u002Fmain\u002Fdata\u002Fskills\u002Fwondelai-skills\u002Fweb-typography\u002FSkill.md",[],[]]