[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72A62V7868ETDZ3NGSQKPVP":3,"skill-same:01M72A62V7868ETDZ3NGSQKPVP":68},{"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":48,"commitSha":49,"skillDirectory":5,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M72A62V7868ETDZ3NGSQKPVP","pdf-to-docx",null,"Convert PDF files to editable Word documents using pdf2docx","claude-office-skills\u002Fskills","claude-office-skills","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F258027507?v=4","01M729XQC9FBRQ54AQZS0KY3ZK","AGI Lab","01M729XQCYW6WF9GY762P9RNQJ",575,"MIT","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fpdf-to-docx\u002FSKILL.md",[],[],"2026-11-10 18:39:20",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":9,"models":32,"license":15,"version":40,"category":29,"languages":41,"department":44,"description":7,"capabilities":45},{"tools":25,"server":27},[26],"pdf_to_docx","office-mcp",[29,30,31],"pdf","docx","conversion",{"compatible":33,"recommended":37},[34,35,36],"claude-3-5-sonnet","gpt-4","gpt-4o",[38,39],"claude-sonnet-4","claude-opus-4","1.0",[42,43],"en","zh","All",[46,47],"format_conversion","editable_documents","main","9c4c7d5cd2813a8936bf2c9fdb174ea883b85a11",105,"https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills","2026-01-31 22:03:56",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add claude-office-skills\u002Fskills --skill pdf-to-docx",{"tool":60,"command":61},"bunx","bunx skills add claude-office-skills\u002Fskills --skill pdf-to-docx",{"tool":63,"command":64},"pnpm","pnpm dlx skills add claude-office-skills\u002Fskills --skill pdf-to-docx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fpdf-to-docx\u002FSKILL.md",true,[],[69,76,83,90,97,104],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M72A0X7X4TWS4ZWTEK8TJEC8","devops-automation","DevOps and IT Ops automation - CI\u002FCD, monitoring, incident management, and infrastructure workflows","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdevops-automation\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M72A0VPXF4Q5F48TPDG6S10Q","dev-slides",">","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdev-slides\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"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},"01M72A0Q1T0KN60CR3PAD93J6T","deep-research","Conduct comprehensive research on any topic. Synthesize information from multiple angles, provide structured analysis, and generate detailed research reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdeep-research\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},"01M72A0KWAYEWQJMDRGC0WTT7V","dcf-valuation","Build Discounted Cash Flow (DCF) valuation models. Calculate intrinsic value with customizable assumptions. Generate professional valuation reports.","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdcf-valuation\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M72A0GVWRZ3HZNXMW3RB5CF9","Database Sync","Automate database synchronization, replication, migration, and cross-platform data integration","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdatabase-sync\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M72A0E16K862EDP0QYEAC9HJ","data-pipeline","Data pipeline and ETL automation - extract, transform, load workflows for data integration and analytics","https:\u002F\u002Fgithub.com\u002Fclaude-office-skills\u002Fskills\u002Fblob\u002Fmain\u002Fdata-pipeline\u002FSKILL.md",[],[]]