nokap
Capture screenshots and PDFs from web pages using headless Chrome via CDP.
What it is and what it does
nokap is a lightweight Python library for capturing screenshots and PDFs from web pages or HTML strings using headless Chrome. It communicates directly with Chrome via the Chrome DevTools Protocol over WebSockets, eliminating the need for browser driver binaries or heavyweight automation frameworks. The library launches and manages a headless Chrome process, connects via CDP, and uses Chrome's native capture methods to render pages to PNG, JPEG, WebP, or PDF formats.
The package is designed for developers who need straightforward web-to-image or web-to-PDF conversion without the complexity of larger automation tools. It supports CSS selectors to capture specific elements, viewport control for responsive layouts, zoom scaling for retina-quality output, and rendering of HTML strings directly. Chrome or Chromium must be installed separately on the system; nokap will locate it automatically. The library is typed, actively maintained, and supports Python 3.10 through 3.13.
Use it for:
- Generate thumbnails or previews of web pages for display in dashboards or content management systems
- Export HTML reports or tables rendered by libraries directly to PDF or image files
- Capture specific page elements using CSS selectors for automated documentation generation
- Convert dynamically generated HTML from templates or data to static images without a full browser
- Create retina-quality screenshots for design mockups or testing responsive layouts at different scales
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
nokap captures screenshots and PDFs from web pages or HTML strings using headless Chrome via the Chrome DevTools Protocol, without requiring Selenium or Playwright.
Yes, if you need simple web-to-image or web-to-PDF capture and already have Chrome or Chromium installed. The low dependency footprint, active maintenance, and permissive MIT license make it a practical choice over heavier frameworks. No known vulnerabilities. Install it if you want straightforward screenshot and PDF generation without Selenium or Playwright overhead; skip it if you need advanced browser automation or don't have Chrome available.
Install
nokap on PyPI
pip
pip install nokapuv
uv add nokappoetry
poetry add nokapInstalling nokap
Before you install
Low friction: pure Python wheel with only two runtime dependencies (websockets and click). Active maintenance as of June 2026. Requires Chrome or Chromium to be installed on the system separately.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install nokap
import nokap
nokap.webshot("https://example.com", "example.png")
nokap.from_html("Hello, world!", "hello.png")
Chrome or Chromium must be installed on the system; nokap will locate it automatically.
Verify before relying
- Whether Chrome binary discovery works reliably across different system configurations and installation methods
- Performance characteristics when capturing many pages or large documents in sequence
- Stability and resource usage of the persistent Chrome process across long-running applications
Package facts
| License | MIT License Copyright (c) 2026 Richard Iannone Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — websockets, click |
| Maintenance | actively maintained — 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 516,706/month — #6,232 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nokap-0.1.0-py3-none-any.whl
Keywords: screenshot, chrome, cdp, pdf, headless, webshot
Tags
More Screen Capture packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
mssCaptures screenshots from one or all monitors…
permissive · top 5,000 on PyPI
dxcamDXcam captures screen frames on Windows at high…
permissive · top 15,000 on PyPI
html2imageGenerates PNG/image files from HTML, CSS, and…
permissive · top 15,000 on PyPI
screenshotoneA Python SDK for the ScreenshotOne.com API that…
permissive · top 15,000 on PyPI
Selenium-ScreenshotCaptures full-page or element-level screenshots…
permissive · top 15,000 on PyPI
shot-scraperA CLI tool that automates taking screenshots of…
permissive · top 15,000 on PyPI
mycdpMyCDP provides autogenerated Chrome DevTools…
permissive · top 15,000 on PyPI
pyppeteerAutomates headless Chrome/Chromium browser…
permissive · top 5,000 on PyPI
pychromePychrome provides a Python interface to control…
permissive · top 15,000 on PyPI
zendriverZendriver is an async-first web automation…
agpl · top 15,000 on PyPI
choreographerChoreographer provides remote control of…
unclear · top 5,000 on PyPI
mkdocs-with-pdfGenerates a single PDF file from an MkDocs…
permissive · top 15,000 on PyPI