[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FVVM4VMPG1F1JWHZQFD713":3,"skill-same:01M6FVVM4VMPG1F1JWHZQFD713":84},{"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":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":6,"ownerHtmlUrl":62,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":63,"install":64,"resources":77},"01M6FVVM4VMPG1F1JWHZQFD713","pdf-to-docx",null,"Convert PDF files to editable Word documents using pdf2docx","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Flijie420461340\u002Fpdf-to-docx\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"PDF","pdf to docx","docx","operations","editable","pdf2docx","word documents","opus","sonnet","files","conversion","github","computer","Word","convert","execution","office","file","code","documents","2026-11-10 10:12:30",false,"---\nname: pdf-to-docx\ndescription: Convert PDF files to editable Word documents using pdf2docx\nauthor: claude-office-skills\nversion: \"1.0\"\ntags: [pdf, word, conversion, pdf2docx, editable]\nmodels: [claude-sonnet-4, claude-opus-4]\ntools: [computer, code_execution, file_operations]\nlibrary:\n  name: pdf2docx\n  url: https:\u002F\u002Fgithub.com\u002Fdothinking\u002Fpdf2docx\n  stars: 3.3k\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",{"name":5,"tags":43,"tools":46,"author":49,"models":50,"library":53,"version":56,"description":7},[44,45,28,23,22],"pdf","word",[30,47,48],"code_execution","file_operations","claude-office-skills",[51,52],"claude-sonnet-4","claude-opus-4",{"url":54,"name":23,"stars":55},"https:\u002F\u002Fgithub.com\u002Fdothinking\u002Fpdf2docx","3.3k","1.0","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Flijie420461340\u002Fpdf-to-docx",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add kbarbel640-del\u002Fskills --skill pdf-to-docx",{"tool":70,"command":71},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill pdf-to-docx",{"tool":73,"command":74},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill pdf-to-docx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Flijie420461340\u002Fpdf-to-docx\u002FSKILL.md",true,[78],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"_meta.json","REFERENCE","参考文档",282,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Flijie420461340\u002Fpdf-to-docx\u002F_meta.json",[85,110,134,152,157,177],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":38},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[92,93,94,95,96,97,98,99,21,100,101,102,103,104,105,106,107,108,109],"crowd prompting","prompting","api","with","tokens","domain","world","prompts","instructions","text","tool","system","improve","productivity","marketplace","https","content","ai agents",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":38},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[117,94,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,99,133],"dilemm ai","arena","analyze","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":38},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[],[141,142,143,144,145,146,147,95,148,131,133,149,94,150,151],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":153,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":38},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[144,143,142,141,151,146,147,95,145,131,133,148,149,94,150],{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":163,"publishedAt":38},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[164,165,166,167,168,169,170,171,172,173,174,175,176],"git","summary","git summary","commits","repository","win32","status","linux","contributors","true","quick","get","branches",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":38},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[],[184,185,186,187,95,188,189,57,190,149,191,192,193,194,195,107,196,197,29],"agent constitution","constitution","contracts","tree","query","base","log","check","Rules","projects","compliance","actions","state","governance"]