general-purpose · version, deps, licence · published, size
modern-screenshot | 4.7.0 · 0 deps · MIT | 16 Apr 2026 · 186 KB |
html-to-image | 1.11.13 · 0 deps · MIT | 14 Feb 2025 · 315 KB |
html2canvas | 1.4.1 · 2 deps · MIT | 22 Jan 2022 · 3.38 MB |
dom-to-image | 2.6.0 · 0 deps · MIT | 4 Oct 2017 · size not reported |
Registry facts, not a review: latest version, declared runtime dependencies, licence, publish date and unpacked size, read from registry.npmjs.org on 31 July 2026. All four are MIT, and three of them declare no runtime dependencies at all.
html2canvas is the exception on both counts — it pulls in css-line-break and text-segmentation, and it is roughly ten times the size of the others on disk. It is also the one that has gone longest without a release apart from dom-to-image, whose latest version is more than eight years old. None of that makes either one broken; plenty of people ship both. It is just what the registry says today.
If you want a general-purpose rasteriser you can point at any node, one of these four is the right answer and Tearline is not.
where Tearline fits
Tearline is not a general rasteriser. It is a custom element that renders whatever you wrap in it as a thermal receipt — paper texture, torn edge, barcode — and then exports that using the technique above. The export is a feature of the component, not a library you can point at an arbitrary div.
Which makes the choice easy. Need a PNG of some existing part of your page? Use one of the four. Need the receipt look — a wrapped-up listening history, an order summary, a share card built out of rules and monospace — and want the export to come with it? That is the whole of what this is for.
the export API
const el = document.querySelector('tear-line'); await el.toBlob({ scale: 2 }); // Blob await el.toDataURL(); // string await el.download('receipt.png'); // saves it The full attribute and method reference is in the documentation, and the component itself is served unminified at /tearline.js. How the receipt look itself is built — the paper, the type and the torn edge, in copyable CSS — is a separate write-up.