Skip to content
Back to skills

Capturing Ebook Pages

ASecurity

用 Playwright 把本地教材 PDF、DOCX、PPT、PPTX 截成 PNG 并写出 manifest(Office 文件先转为 PDF 或 HTML)。 用户提到电子书截图、教材截图、截 PDF/PPT/DOCX 页面、给教案配图时使用。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
ai-agentspythonbash

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 7 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add weoifgiljb/lesson-plan-design --skill capturing-ebook-pages --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Capturing Ebook Pages?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Capturing Ebook Pages
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/weoifgiljb-capturing-ebook-pages/badge)](https://www.skillsdirectory.com/skills/weoifgiljb-capturing-ebook-pages)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: capturing-ebook-pages
description: >
  用 Playwright 把本地教材 PDF、DOCX、PPT、PPTX 截成 PNG 并写出 manifest(Office 文件先转为 PDF 或 HTML)。
  用户提到电子书截图、教材截图、截 PDF/PPT/DOCX 页面、给教案配图时使用。
compatibility: Requires Python 3 and Playwright Chromium. Optional LibreOffice, mammoth, and python-pptx.
---

# Capturing Ebook Pages

## Instructions

1. 只要本机文件路径。不要去登录网页、DRM 阅读器或在线书城。
2. 依赖写在本技能说明里,不要在 `lesson-plan-design` 的校验脚本里 import Playwright:

```bash
pip install playwright mammoth python-pptx
py -3 -m playwright install chromium
```

3. 在本技能根目录运行:

```bash
py -3 scripts/capture_ebook.py <book.pdf> -o output/ebook-captures/<stem> --pages 3-7
```

   省略 `--pages` 则截全部页。`--pages` 支持 `3-7` 或 `1,3,5`。
4. 读 `manifest.json`(`source`、`page`、`png`、`caption`),把选用页写入教案 `mediaAssets`,再按 `formatting-lesson-docx` / `lesson-plan-design` 导出 Word。
5. 适配规则:
   - PDF:Chromium 打开 `file://…#page=N`,按视口截当前页(不要 `full_page`,避免整本滚进一张图)
   - DOCX / PPTX:有 LibreOffice(`soffice`)则转 PDF;否则 mammoth / python-pptx 转 HTML(无 soffice 时 .docx 整份算 1 页;复杂 PPTX 会失真)
   - `.ppt`:必须有 LibreOffice;没有就失败并说明原因,禁止假装成功
6. 缺少 Chromium 时退出码非 0,并提示 `pip install playwright && py -3 -m playwright install chromium`。截图失败不得跳过教案审查。

## Examples

用户:把 `教材/C语言.pdf` 第 3 到 5 页截下来,挂到知识学习。

```bash
py -3 scripts/capture_ebook.py 教材/C语言.pdf -o output/ebook-captures/C语言 --pages 3-5
```

然后写入:

```json
"mediaAssets": [
  {"path": "output/ebook-captures/C语言/page-003.png", "caption": "教材第3页", "attachTo": "knowledgeLearning"}
]
```

用户:截这份 `旧版.ppt`。若本机没有 LibreOffice,应明确报「旧版 .ppt 需要 soffice」,不要输出空白 PNG。

## Additional Resources

- 脚本:[scripts/capture_ebook.py](scripts/capture_ebook.py)
- 测试:[test/index.py](test/index.py)
- Word 嵌图:`formatting-lesson-docx`
- 教案门禁:`lesson-plan-design`

Files in this skill

  • SKILL.md2.3 KB
  • scripts/capture_ebook.py12.6 KB
  • test/index.py457 B
  • test/support.py2.6 KB
  • test/test_adapters.py3.9 KB
  • test/test_pages.py715 B
  • test/test_playwright.py1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.