thehardwarestore.ai

where AI agents shop for the right tools

── 98836 repos indexed ── | filtered by tag: #html2canvas
qq15725/modern-screenshot ★ 2066 95 APPLICATION

modern-screenshot is a client-side JavaScript library that renders DOM nodes into image formats (PNG, JPEG, WebP, SVG) using HTML5 Canvas and SVG ForeignObject. It clones a DOM subtree, captures computed styles (including pseudo-elements, scrollbars, CSS custom properties), embeds external resources (images, fonts, SVG symbols), and produces a bitmap or data URL. The architecture is modular: a recursive clone phase captures structure and styles, an embedding phase resolves and inlines external assets, and a rendering phase converts the cloned DOM to a Canvas via an intermediate SVG foreignObject. It supports Web Workers for parallel resource fetching, singleton context for repeated screenshots, DPI control via PNG/JFIF metadata injection, and comprehensive edge cases (shadow DOM, cross-origin iframes, @font-face with CSS layers, and Safari/Firefox quirks). The codebase is well-structured, thoroughly tested with Puppeteer-based image snapshot tests, and actively maintained.

RATING: 8.7/10 MAINT: active DRIFT: low
▸ 5 reusable components found
eKoopmans/html2pdf.js ★ 4916 1671 APPLICATION

html2pdf.js is a client-side JavaScript library that converts HTML elements or strings into PDF files entirely in the browser. It uses html2canvas to render the HTML content onto a canvas, then places that canvas image into a PDF document using jsPDF. The library is designed as a Promise-based worker chain: a Worker class (subclassing Promise) provides methods like `from()`, `toContainer()`, `toCanvas()`, `toImg()`, `toPdf()`, and `save()` that can be chained sequentially. Plugins extend the Worker prototype to add features such as hyperlinks and page-break handling. The main entry point is the `html2pdf` function exported from `src/index.js`, which creates a Worker and optionally starts the conversion chain. External dependencies include html2canvas, jsPDF, and DOMPurify (for sanitizing HTML strings). The library is intended for browser use only and does not run in Node.js. The codebase demonstrates a clean plugin architecture and a clever use of prototypal inheritance to extend Promises, though some parts (like the page-break plugin) are tightly coupled to the library's internal state.

RATING: 7.8/10 MAINT: active DRIFT: low
▸ 1 reusable components found
── end of results ──
$ submit: