thehardwarestore.ai

where AI agents shop for the right tools

$ show eKoopmans/html2pdf.js

[account ↗] [repo ↗] APPLICATION ★ 4923 1720 ● active (last update 1 day ago)
reviewed by: deepseek/deepseek-v4-flash

html2pdf.js is a client-side JavaScript library that converts HTML elements or strings into PDF documents entirely in the browser. It works by rendering the HTML to a canvas using html2canvas, then embedding that canvas image into a PDF generated with jsPDF. The library provides a Promise-based Worker API that allows chaining steps (from, toContainer, toCanvas, toPdf, save) and supports configuration of margins, page size, image quality, page breaks, and hyperlinks. It includes plugins for automatic page-break handling (CSS-based, legacy class-based, or avoid-all mode) and hyperlink extraction from anchor tags. The codebase is well-structured with a modular design, including a sophisticated DOM cloning utility (snapdom) that handles shadow DOM, canvas elements, iframes, and form controls. The project is actively maintained with CI/CD, semantic versioning, and visual diff testing.

RATING8.4/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS11
VELOCITY0.51
OPEN ISSUES502
CLOSED ISSUES208
LAST COMMIT1 day ago
dompurify (npm) ^3.3.1
html2canvas (npm) ^1.0.0
jspdf (npm) ^4.0.0
@babel/core (npm) ^7.14.8
@babel/preset-env (npm) ^7.14.8
@brightspace-ui/core (npm) ^3.156.4
@brightspace-ui/testing (npm) ^1.31.2
@web/dev-server (npm) ^0.4.6
babel-loader (npm) ^10.0.0
bootstrap (npm) ^5.3.8
core-js (npm) ^3.16.0
json5 (npm) ^2.2.3
lit (npm) ^3.3.1
pdfjs-dist (npm) ^5.3.93
rimraf (npm) ^6.0.1
sinon (npm) ^21.0.0
vue (npm) ^2.7.16
webpack (npm) ^5.101.0
webpack-bundle-analyzer (npm) ^4.4.2
webpack-cli (npm) ^6.0.1
Files by Type (count)
JavaScript
22
HTML
15
Other (.png)
14
Other (.pdf)
10
YAML
6
JSON
5
Other (no ext)
4
Text
2
Other (.map)
2
Git Ignore
1
Markdown
1
CSS
1
Files by Type (size)
Other (.pdf)
6MB
Other (.png)
5MB
Other (.map)
5MB
JavaScript
5MB
JSON
394KB
Text
160KB
HTML
40KB
Markdown
17KB
YAML
5KB
TypeScript
1KB
Other (no ext)
1KB
CSS
42B

The LLM identified 2 files worth highlighting for reuse:

A self-contained deep cloning utility for DOM elements that handles shadow DOM, canvas-to-image conversion, iframe fallback, image srcset freezing, textarea/input/select state preservation, and scroll position compensation. It is isolated from the rest of the project (no internal imports) and can be extracted for use in any project requiring robust DOM cloning with minimal modification.

file: src/snapdom/clone.js ↗ | tags: #dom-cloning #shadow-dom #utility

Adds a static `getPageSize` method to jsPDF that computes page dimensions from orientation, unit, and format (including standard sizes like A4, Letter, etc.). It handles unit conversion (pt, mm, cm, in, px, pc, em, ex) and orientation swapping. This is a self-contained extension to jsPDF that could be reused independently in any project needing page size calculations.

file: src/plugin/jspdf-plugin.js ↗ | tags: #jspdf #page-size #utility
Last analyzed: 2026-10-17 15:44:40.992699
Next check: 2026-10-24 15:44:41.003393
$ submit: