pdf-creator
by daymade
Create PDF documents from markdown with proper Chinese font support using weasyprint. This skill should be used when converting markdown to PDF, generating formal documents (legal, trademark filings, reports), or when Chinese typography is required. Triggers include "convert to PDF", "generate PDF", "markdown to PDF", or any request for creating printable documents.
安装
安装命令
git clone https://github.com/daymade/claude-code-skills/tree/main/pdf-creator文档
PDF Creator
Create professional PDF documents from markdown with proper Chinese font support.
Quick Start
Convert a single markdown file:
cd /Users/tiansheng/Workspace/python/claude-code-skills/pdf-creator
uv run --with weasyprint --with markdown scripts/md_to_pdf.py input.md output.pdf
Batch convert multiple files:
uv run --with weasyprint --with markdown scripts/batch_convert.py *.md --output-dir ./pdfs
macOS ARM (Homebrew) 的 DYLD_LIBRARY_PATH 会自动检测配置,无需手动设置。
Font Configuration
The scripts use these Chinese fonts (with fallbacks):
| Font Type | Primary | Fallbacks |
|---|---|---|
| Body text | Songti SC | SimSun, STSong, Noto Serif CJK SC |
| Headings | Heiti SC | SimHei, STHeiti, Noto Sans CJK SC |
Output Specifications
- Page size: A4
- Margins: 2.5cm top/bottom, 2cm left/right
- Body font: 12pt, 1.8 line height
- Max file size: Designed to stay under 2MB for form submissions
Common Use Cases
- Legal documents: Trademark filings, contracts, evidence lists
- Reports: Business reports, technical documentation
- Formal letters: Official correspondence requiring print format
Troubleshooting
Problem: Chinese characters display as boxes Solution: Ensure Songti SC or other Chinese fonts are installed on the system
Problem: weasyprint import error
Solution: Run with uv run --with weasyprint --with markdown to ensure dependencies
相关 Skills
by anthropics
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
by anthropics
Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
by anthropics
Use this skill any time a .pptx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx filename, regardless of what they plan to do with the content afterward. If a .pptx file needs to be opened, created, or touched, use this skill.