Capture any web page — especially slide-based presentations — as a multi-page PDF using a headless browser.
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:
ModelDetectionExamplesreveal.js.reveal element + Reveal JS APIreveal.js decksVertical scrollPage height > 1.5× viewport, multiple slide elementsCustom JS slide decks with stacked sectionsKeyboardMultiple slide elements, not scrollableimpress.js, deck.js, arrow-key decksSingle pageNo slide structure detectedRegular web pages, articles
The script bundles its own package.json. On first use (or if node_modules is missing), install dependencies:
bash
cd ${CLAUDE_SKILL_DIR}/scripts && npm install && npx playwright install chromium
Pillow (Python) is also required for PNG-to-PDF assembly:
bash
pip install Pillow
Run the capture script:
bash
node ${CLAUDE_SKILL_DIR}/scripts/capture.mjs <url> <output.pdf> [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
bash
# 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
playwright and Pillow are installed; install if missing--wait 2000 for slower transitions, or check if the site requires interaction (cookie banners, login) before slides are accessible.--wait to give JS more time to render.--max-slides and verify the slide selector detected is correct by inspecting the script's console output.