mcpField
H
html-to-pptx

html-to-pptx

github.com/nlj626Documents1197 installsUpdated 28w ago
Repository

About html-to-pptx

A skill that converts HTML presentations into PPTX files by capturing each slide as an image and assembling the images into a deck. It is for users who need to share HTML-based presentations in PPTX format; slide text in the result is not editable.

Key features

  1. 01Render slides with headless Chrome
  2. 02Assemble images using pptxgenjs
  3. 03Detect slide count or specify it
  4. 04Set aspect ratio and image quality

Use cases

  1. 01Export an HTML deck as PPTX
  2. 02Share HTML presentations with PPTX-only recipients

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/nlj626/html-to-pptx --skill html-to-pptx

After installing, type/html-to-pptxin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE
.gitignore
README.md
scripts/
html-to-pptx.sh
render.sh
html-to-pptx.cjs

Details

From the project README

html-to-pptx — HTML 演示文稿转 PPTX

将 html-ppt 生成的 HTML 演示文稿一键转换为 .pptx 文件。

Agent 使用指南

当用户说"导出 PPTX"、"转成 PPT"、"HTML 变 PPTX"或类似的话时:

  1. 确认 HTML 文件路径 — 通常在 ~/.claude/skills/html-ppt/examples/<deck-name>/index.html,或用户指定的路径
  2. 运行转换命令:
    bash ~/.claude/skills/html-to-pptx/scripts/html-to-pptx.sh <html文件路径>
    
  3. 报告结果 — 告诉用户 PPTX 文件的路径和大小
  4. 可选参数:
    • --ratio 4:3 — 指定宽高比(支持 16:9、4:3、3:4、1:1)
    • -- --quality 80 — 指定 JPEG 质量(1-100,默认 92)
    • -- --quality png — 强制 PNG 格式(无损但文件较大)

工作原理

  1. headless Chrome 截图:逐页将 HTML 渲染为 PNG 图片(支持 #/N 深度链接)
  2. pptxgenjs 组装:将图片按顺序嵌入 PPTX,每张铺满整页

因为是截图方式,PPTX 会 100% 还原 HTML 的视觉效果,包括字体、颜色、布局、渐变等。

命令参考

# 自动检测页数
bash scripts/html-to-pptx.sh /path/to/deck/index.html

# 指定页数
bash scripts/html-to-pptx.sh /path/to/deck/index.html 8

# 4:3 宽高比
bash scripts/html-to-pptx.sh /path/to/deck/index.html all --ratio 4:3

# 指定 JPEG 质量(更小文件)
bash scripts/html-to-pptx.sh /path/to/deck/index.html all -- --quality 80

# 无损 PNG 格式
bash scripts/html-to-pptx.sh /path/to/deck/index.html all -- --quality png

输出文件与 HTML 同目录,文件名相同但扩展名为 .pptx。

依赖

  • Google Chrome:macOS 默认路径 /Applications/Google Chrome.app
  • pptxgenjs:npm install -g pptxgenjs

注意事项

  • 输出的 PPTX 中每页是一张图片,不可编辑文字(但视觉效果完美还原)
  • 如果需要可编辑文字的 PPTX,应使用 pptx skill 从头创建
  • 适合场景:需要将 html-ppt 作品分享给只接受 PPTX 格式的同事/客户

Comments

Markdown supported