← 返回
未分类 中文

Web to PDF

Convert a web page to PDF, especially web-based slide decks and presentations (reveal.js, impress.js, custom JS slideshows, scroll-based decks). Use when the...
将网页转换为PDF,特别适用于基于网页的幻灯片和演示文稿(reveal.js、impress.js、自定义JS幻灯片、滚动式演示等)。用于...
pearyj
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 683
下载
💾 1
安装
1
版本
#latest#pdf#playwright#presentation#slides#web

概述

Web to PDF

Capture any web page — especially slide-based presentations — as a multi-page PDF using a headless browser.

How it works

A bundled Playwright script screenshots each slide (or the full page) as PNG, then assembles them into a PDF via Pillow. It auto-detects the navigation model:

ModelDetectionExamples
---------------------------
reveal.js.reveal element + Reveal JS APIreveal.js decks
Vertical scrollPage height > 1.5× viewport, multiple slide elementsCustom JS slide decks with stacked sections
KeyboardMultiple slide elements, not scrollableimpress.js, deck.js, arrow-key decks
Single pageNo slide structure detectedRegular web pages, articles

Prerequisites

The script bundles its own package.json. On first use (or if node_modules is missing), install dependencies:

cd ${CLAUDE_SKILL_DIR}/scripts && npm install && npx playwright install chromium

Pillow (Python) is also required for PNG-to-PDF assembly:

pip install Pillow

Usage

Run the capture script:

node ${CLAUDE_SKILL_DIR}/scripts/capture.mjs <url> <output.pdf> [options]

Options

FlagDefaultDescription
----------------------------
--width N1920Viewport width in pixels
--height N1080Viewport height in pixels
--wait N1000Milliseconds to wait per slide for animations
--max-slides N50Safety cap on number of slides

Examples

# Presentation deck at 1080p
node ${CLAUDE_SKILL_DIR}/scripts/capture.mjs https://example.com/pitch output.pdf

# Narrow viewport for mobile-style capture
node ${CLAUDE_SKILL_DIR}/scripts/capture.mjs https://example.com/page doc.pdf --width 1280 --height 720

# Slow animations, give extra time
node ${CLAUDE_SKILL_DIR}/scripts/capture.mjs https://example.com/deck slides.pdf --wait 2000

Workflow

  1. Check that playwright and Pillow are installed; install if missing
  2. Run the capture script with the user's URL and desired output path
  3. Verify the output — check page count and spot-check a few pages by reading the PDF or individual screenshots
  4. Report the result to the user (page count, file size, output path)

Troubleshooting

  • Slides all identical: The navigation detection may have picked the wrong model. Try adding --wait 2000 for slower transitions, or check if the site requires interaction (cookie banners, login) before slides are accessible.
  • Missing content / animations not rendered: Increase --wait to give JS more time to render.
  • Blank pages: Some sites lazy-load content; the scroll-based capture handles this by scrolling to each slide. If keyboard navigation produces blanks, the site may actually be scroll-based.
  • Too few / too many pages: Check --max-slides and verify the slide selector detected is correct by inspecting the script's console output.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-02 07:44 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,055 📥 795,847
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 666 📥 323,786
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,349 📥 317,694