How-To Guides
zumerlab/snapdom

How to capture the DOM

Short, focused recipes that show one task each — copy the snippet, drop it into your project, ship.

Recipe

Screenshot a div in JavaScript

The shortest possible answer: pick the element, call SnapDOM, get an image. With a working example.

Recipe

Convert HTML to PNG

Three patterns: append to the page, download to disk, or serialise to a Blob/Base64 for upload.

What's a how-to?

Each how-to answers exactly one question with the minimum amount of code. They're meant to be skimmed: you find the recipe, copy it, paste it, done. If you want a deeper walkthrough for a specific framework, see the framework guides instead.

Need a recipe that's not here?

Open an issue on GitHub describing the task and we'll add it.

Request a recipe Open the demo