A professional resume generator skill for creating beautiful, print-ready resumes with multiple export formats (PDF, Word, HTML) and full Chinese character support.
# Clone the repository
git clone https://github.com/yourusername/resume-generator.git
# Install dependencies
pip install reportlab pyyaml python-docx beautifulsoup4
# Optional: For better PDF quality from HTML
pip install weasyprint pdfkit
# Register with OpenClaw
openclaw skills install resume-generator
# Generate from config file
python generate_resume.py --config resume_config.yaml --output resume.pdf
# Use specific template
python generate_resume.py --config config.yaml --template modern_blue --output resume.pdf
# Convert HTML resume to PDF
python scripts/resume_to_pdf.py input.html output.pdf
# Use specific template
python scripts/resume_to_pdf.py input.html output.pdf --template modern
# Convert HTML to Word
python scripts/resume_to_docx.py input.html output.docx
# Convert Markdown to Word
python scripts/resume_to_docx.py input.md output.docx --markdown
from scripts.resume_pdf import ResumePDFGenerator
# Create generator
gen = ResumePDFGenerator(theme='modern_blue')
# Add content
gen.add_header(
name="张三",
title="高级工程师",
phone="138-0000-0000",
email="example@example.com",
address="北京市海淀区示例路1号"
)
gen.add_section("工作经历", [
{
"title": "高级工程师",
"org": "某某科技有限公司",
"period": "2020-至今",
"detail": "软件开发 · 系统架构设计"
}
])
# Generate PDF
gen.save("resume.pdf")
Best for programmatic resume creation from Python:
from scripts.resume_pdf import ResumePDFGenerator
gen = ResumePDFGenerator(theme='modern_blue')
gen.add_header(...)
gen.add_section(...)
gen.save("output.pdf")
Best for converting existing HTML resumes:
# Tries multiple PDF backends automatically
python scripts/resume_to_pdf.py resume.html output.pdf
# Supported backends (auto-detected):
# - WeasyPrint (best quality)
# - pdfkit (requires wkhtmltopdf)
# - ReportLab (fallback)
# - FPDF (fallback)
Best for creating editable documents:
# Markdown to Word
python scripts/resume_to_docx.py resume.md output.docx --markdown
# HTML to Word
python scripts/resume_to_docx.py resume.html output.docx
name: "张三"
title: "高级工程师 · 某某科技有限公司"
contact:
phone: "138-0000-0000"
email: "example@example.com"
address: "北京市海淀区示例路1号"
sections:
- title: "工作经历"
items:
- title: "高级工程师"
org: "某某科技有限公司"
period: "2020-至今"
detail: "软件开发 · 系统架构设计"
- title: "教育背景"
items:
- title: "计算机科学硕士"
org: "某某大学"
period: "2010-2013"
detail: "导师:某某教授"
- title: "发表论文"
type: "publications"
items:
- "[1] Author et al. Paper title[J]. Journal, Year."
- "[2] ..."
class ResumePDFGenerator:
def __init__(self, theme='modern_blue'):
"""Initialize with theme name."""
def add_header(self, name, title, phone, email, address):
"""Add resume header."""
def add_section(self, title, items):
"""Add a content section."""
def add_publications(self, papers):
"""Add publications section."""
def save(self, output_path):
"""Generate and save PDF."""
from scripts.resume_to_pdf import generate_pdf
# Convert HTML file to PDF
generate_pdf('input.html', 'output.pdf', template='modern')
# Convert HTML string to PDF
html_content = "<h1>Name</h1><p>Content...</p>"
generate_pdf(html_content, 'output.pdf', template='classic')
from scripts.resume_to_docx import generate_docx, generate_docx_from_markdown
# HTML to Word
generate_docx('input.html', 'output.docx', template='modern')
# Markdown to Word
generate_docx_from_markdown('input.md', 'output.docx', template='classic')
See examples/ directory for complete resume samples:
example_resume.yaml - Academic researcher CVacademic_cv.yaml - Academic CV with publicationsprofessional_resume.yaml - Industry resumeminimal_resume.yaml - One-page minimal designresume-generator/
├── SKILL.md # Skill documentation
├── README.md # Project readme
├── LICENSE # MIT License
├── generate_resume.py # Main CLI entry point
├── requirements.txt # Python dependencies
├── scripts/
│ ├── resume_pdf.py # Direct PDF generation (ReportLab)
│ ├── resume_to_pdf.py # HTML to PDF conversion
│ └── resume_to_docx.py # HTML/Markdown to Word
├── examples/
│ └── example_resume.yaml
└── assets/
└── templates/ # HTML templates
from scripts.resume_pdf import ResumePDFGenerator
# Use custom colors
gen = ResumePDFGenerator(
theme='modern_blue',
primary_color='#1e3a5f',
accent_color='#2c5282'
)
The generator automatically handles pagination:
# Generate multiple resumes
for file in configs/*.yaml; do
python generate_resume.py --config "$file" --output "output/$(basename $file .yaml).pdf"
done
Ensure you have Chinese fonts installed:
/System/Library/Fonts/STHeiti Medium.ttcfonts-wqy-microheiThe skill will automatically fallback to HTML output if PDF libraries are unavailable. Open the HTML in browser and print to PDF.
Make sure python-docx is installed:
pip install python-docx beautifulsoup4
Required:
reportlab - PDF generationpyyaml - YAML config parsingpython-docx - Word document generationbeautifulsoup4 - HTML parsingOptional (for better PDF quality):
weasyprint - High-quality HTML to PDFpdfkit - wkhtmltopdf wrapperMIT License - See LICENSE file for details.
Pull requests welcome! Please follow the existing code style and add tests for new features.
共 1 个版本