prep-pdf
Playwright-free PDF preparation. Reads lecture-profile.md, resolves the 4-layer spec merge, validates fonts, outputs a layout summary, and optionally generates a sample PDF. Replaces the deprecated measure skill (Playwright-dependent). Responds to "prep for PDF", "estimate layout", "check PDF layout". Stages 9-10 of the lecture workflow (simplified).
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-14
- Stars
- ★ 25
- Forks
- 9
01 前言 Front Matter
- name
- prep-pdf
- owner
- pdf-export
- scope
- co-deck
- status
- active
- version
- 2.0.0
- relates_to
- [ { "type": "follows", "skill": "version" } ]
- description
- Playwright-free PDF preparation. Reads lecture-profile.md, resolves the 4-layer spec merge, validates fonts, outputs a layout summary, and optionally generates a sample PDF. Replaces the deprecated measure skill (Playwright-dependent). Responds to "prep for PDF", "estimate layout", "check PDF layout". Stages 9-10 of the lecture workflow (simplified).
- last_reviewed
- 1782172800000
- prerequisites
- html-build
03 SKILL.md 正文
Context
Prepares the project for PDF generation without requiring Playwright. The previous
measure skill used Playwright to measure rendered HTML, but its output was never
consumed by gen-slides-pdf.ts. The PDF renderer reads static theme JSON files via
a 4-layer merge (base → theme → style → overrides). This skill validates that all
pieces are in place and produces a summary of what the PDF will look like.
When to Use
- PM Agent dispatches after Gate 4 (Build approval)
- User says "prep for PDF", "estimate layout", "check PDF layout"
- Before PDF export to verify fonts and spec merge
Execution Steps
Step 1: Estimate Layout
bun scripts/co-deck/estimate-layout.ts --project presentations/<project>
This automatically:
- Reads
lecture-profile.md(theme + style + layout_overrides) - Loads the 4-layer spec merge (base → theme → style → overrides)
- Validates the merged spec has regions and slide types
- Checks font availability (Pretendard or MaruBuri)
- Outputs
layout_summary.mdto the project folder
No Playwright installation required.
Step 2: Font Download (if needed)
If the font check reports missing fonts:
bun scripts/co-deck/download-font.ts pretendard
Step 3: (Optional) Auto-Calibrate (CSS Estimation)
For new themes or when tuning layout, generate estimated overrides from CSS:
bun scripts/co-deck/gen-slides-pdf.ts --auto-calibrate --project presentations/<project>
This reads CSS custom properties and computes estimated layout_overrides values.
Copy the printed YAML block into lecture-profile.md.
Step 4: (Optional) Iterative Calibration Loop
For precise layout tuning, run the numerical calibration loop:
bun scripts/co-deck/auto-calibrate.ts --project presentations/<project> --max-iter 3 --sample 5
This generates a 5-page sample PDF, converts it to images (requires pdf-to-png-converter v4),
numerically validates font sizes and line heights, auto-adjusts layout_overrides, and repeats
up to 3 iterations. After the loop, it prompts for user approval of the final values.
If pdf-to-png-converter is not installed, the step degrades gracefully — it still generates
the sample PDF and validates the spec merge, but skips image-based numerical validation.
Step 5: Generate Sample PDF
bun scripts/co-deck/estimate-layout.ts --project presentations/<project> --sample
Or directly:
bun scripts/co-deck/gen-slides-pdf.ts --project presentations/<project> --sample 5
Output Format
presentations/<project>/layout_summary.md— spec merge summary (regions, fonts, sizes)presentations/<project>/sample_5slides.pdf— sample for Gate 5 review (with --sample)presentations/<project>/calibration_report.md— iterative calibration results (with auto-calibrate.ts)
Key Differences from Deprecated measure Skill
| Aspect | measure (deprecated) | prep-pdf (current) |
|---|---|---|
| Playwright | Required | Not required |
| Output | layout_spec.json (unused) | layout_summary.md (review reference) |
| Screenshots | Yes (via Playwright) | No |
| Spec merge | No | Yes (4-layer preview) |
| Font check | Manual | Automatic |
| Sample PDF | Separate step | Integrated (--sample flag) |
Related Skills
html-build— produces the HTML filepdf-export— generates the final PDF (consumes the same 4-layer spec)version— snapshot files before PDF regeneration
04 同仓库更多 Skills
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.
i18n-layout
Text layout and encoding guidance: character encoding (UTF-8, legacy Korean code pages, BOM hazards), line endings, RTL/bidi handling, and script-specific font selection (Hangul focus). Use when: encoding is corrupted or mojibake appears, an RTL locale must render correctly, fonts must be chosen for a script, or CRLF/BOM issues surface.