pdf-export
Generates PDF from slide data using pdf-lib. Extracts slidedata.json, runs sample (5-slide) then full PDF generation scripts, reviews results. Reads the 4-layer spec merge (base → theme → style → overrides) directly — no Playwright measurement required. Responds to "make PDF", "export PDF", "convert to PDF". Stage 11 of the lecture workflow.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-14
- Stars
- ★ 25
- Forks
- 9
01 前言 Front Matter
- name
- pdf-export
- owner
- pdf-export
- scope
- co-deck
- inputs
- [ "slide-html" ]
- status
- active
- outputs
- [ "final-pdf" ]
- version
- 2.1.2
- relates_to
- [ { "type": "composes_with", "skill": "research" }, { "type": "composes_with", "skill": "storyline" } ]
- description
- Generates PDF from slide data using pdf-lib. Extracts slidedata.json, runs sample (5-slide) then full PDF generation scripts, reviews results. Reads the 4-layer spec merge (base → theme → style → overrides) directly — no Playwright measurement required. Responds to "make PDF", "export PDF", "convert to PDF". Stage 11 of the lecture workflow.
- last_reviewed
- 1794268800000
- prerequisites
- prep-pdf
- catalog-parity
- skip
03 SKILL.md 正文
Context
Generates the final lecture PDF from slide content using pdf-lib. The PDF renderer
uses a 4-layer spec merge (layout_base.json → theme pdf_layout_spec.json → style
pdf_color_spec.json → lecture-profile.md layout_overrides). No Playwright measurement
is required — the theme JSON files contain all calibrated layout values.
Runs a 5-slide sample first for Gate 5 review, then generates the full PDF after user approval. Invoked at Stage 11, after the prep-pdf skill completes.
When to Use
- PM Agent dispatches after prep-pdf skill completes
- User says "make PDF", "export PDF", "convert to PDF"
- After HTML or layout changes require PDF regeneration
Execution Steps
Step 1: Confirm Required Inputs
All inputs must exist before starting:
| File | Produced by |
|---|---|
slidedata.json |
extract_slidedata.mjs (or prep-pdf --sample) |
presentations/assets/fonts/<FontName>-Regular.ttf |
download-font.ts (or prep-pdf) |
presentations/assets/fonts/<FontName>-Bold.ttf |
download-font.ts (or prep-pdf) |
| HTML file | Build Agent |
image-manifest.json (optional) |
Image Curator — background_image paths |
assets/images/bg-*.<ext> (optional) |
Image Curator — background image files |
Dependencies (pre-installed via bun install):
pdf-lib— PDF generationfflate— compression@pdf-lib/fontkit— Korean font embedding
Font source of truth: the sample/full PDF embeds fonts from
presentations/assets/fonts/ (default Pretendard Regular/Bold). That family is
the deck's typographic reference — the HTML deck must embed the same family
(html-build SKILL, "Font Parity"). Any font change lands in BOTH engines in one
change. Gate 5 sample review includes a font-parity spot-check (DG-DECK-06).
Step 2: Extract slideData
If slidedata.json does not exist yet:
bun scripts/co-deck/extract_slidedata.mjs "path/to/lecture.html"
→ Produces slidedata.json
Step 3: Generate Sample PDF (5 slides)
Before the full run, generate a 5-slide sample for layout sanity check.
bun scripts/co-deck/gen-slides-pdf.ts --project presentations/<project> --sample 5
Share the sample with the user for review. If approved, proceed to Step 4 (★ Gate 5: approval required before full PDF).
Step 4: Generate Full PDF
bun scripts/co-deck/gen-slides-pdf.ts --project presentations/<project>
# Custom output filename:
bun scripts/co-deck/gen-slides-pdf.ts --project presentations/<project> --out <filename>.pdf
Layout customization — edit lecture-profile.md → layout_overrides:
layout_overrides:
fonts:
title_pt: 28
bullet_pt: 13
line_heights:
title_px: 48
bullet_px: 28
The --auto-calibrate flag can suggest starting values:
bun scripts/co-deck/gen-slides-pdf.ts --auto-calibrate --project presentations/<project>
Background image rendering (v1.7.0):
When lecture-profile.md has background_image.enabled: true, the PDF renderer applies image backgrounds per the configured scope:
| Scope | Slides affected |
|---|---|
all |
Every slide |
divider-cover |
Title, divider, and punchline slides only |
individual |
Per-slide entries from image-manifest.json |
Rendering pipeline: full-bleed cover-crop → semi-transparent overlay (configured by overlay.color and overlay.opacity). Image paths are resolved from image-manifest.json first, then slideData.backgroundImage, then fallback_color solid fill.
Output Format
presentations/<project>/[project]_v[version].pdf— full presentation PDFpresentations/<project>/sample_5slides.pdf— sample for Gate 5 reviewpresentations/<project>/speaker-notes_<lang>.txt— speaker-notes handoff file, produced alongside the full PDF per the convention indocs/speaker-notes-export.md
Related Skills
prep-pdf— prepares fonts, validates spec merge, generates sampleversion— snapshot the HTML and layout files before regenerating the PDF
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.