PDF to Word Converter (pdf2docx)
Convert PDF files to Word (.docx) using the pdf2docx library (based on PyMuPDF + python-docx). Preserves paragraphs, tables, images, and font styles.
When to Use
- User mentions: "pdf2word", "PDF转Word", "PDF to Word", "PDF转docx"
- Need to convert a PDF into an editable Word document
- Need to fill in a PDF form but need Word format first
Dependencies
python -m pip install pdf2docx 2>&1 | tail -3
Usage
python "<LOCAL_USER>/.claude/skills/pdf2word/pdf2word.py" <input.pdf> [output.docx] [--start PAGE] [--end PAGE] [--pages 0,1,2]
Arguments
| Argument | Required | Description |
|---|---|---|
input.pdf |
Yes | Input PDF file path |
output.docx |
No | Output Word file path (default: same name as PDF with .docx extension) |
--start |
No | Start page (0-indexed, default: 0) |
--end |
No | End page (exclusive, default: all pages) |
--pages |
No | Specific pages to convert (comma-separated, 0-indexed) |
Examples
# Convert entire PDF
python "<LOCAL_USER>/.claude/skills/pdf2word/pdf2word.py" "report.pdf"
# Convert with custom output name
python "<LOCAL_USER>/.claude/skills/pdf2word/pdf2word.py" "report.pdf" "output.docx"
# Convert pages 1-3 (0-indexed: 0,1,2)
python "<LOCAL_USER>/.claude/skills/pdf2word/pdf2word.py" "report.pdf" --start 0 --end 3
# Convert specific pages
python "<LOCAL_USER>/.claude/skills/pdf2word/pdf2word.py" "report.pdf" --pages 0,2,4
Workflow
- Install
pdf2docxif not present - Run
pdf2word.pywith the PDF path - Output
.docxis saved alongside the original PDF (or at specified path) - Use
assignment-wordskill'sinfocommand to inspect the resulting docx structure
Limitations
- Complex layouts (multi-column, floating elements) may not convert perfectly
- Scanned/image-based PDFs will not have editable text
- Very large PDFs may be slow — use
--start/--endto convert page ranges
Rules
- Always use
PYTHONIOENCODING=utf-8on Windows - Always use
python -m pip installfor dependencies - Report any conversion warnings to the user