New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dom-to-image-more

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-to-image-more

Generates an image from a DOM node using HTML5 canvas and SVG

  • 3.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
106K
increased by5.62%
Maintainers
0
Weekly downloads
 
Created

What is dom-to-image-more?

The dom-to-image-more package is a JavaScript library that allows you to convert DOM nodes into images. It is useful for capturing screenshots of web pages or specific elements within a page, and it supports various output formats such as PNG, JPEG, and SVG.

What are dom-to-image-more's main functionalities?

Convert DOM to PNG

This feature allows you to convert a DOM node into a PNG image. The code sample demonstrates how to capture an element with the ID 'my-node' and append the resulting image to the document body.

domtoimage.toPng(document.getElementById('my-node')).then(function (dataUrl) { var img = new Image(); img.src = dataUrl; document.body.appendChild(img); }).catch(function (error) { console.error('oops, something went wrong!', error); });

Convert DOM to JPEG

This feature allows you to convert a DOM node into a JPEG image with a specified quality. The code sample shows how to capture an element and download it as a JPEG file.

domtoimage.toJpeg(document.getElementById('my-node'), { quality: 0.95 }).then(function (dataUrl) { var link = document.createElement('a'); link.download = 'my-image-name.jpeg'; link.href = dataUrl; link.click(); }).catch(function (error) { console.error('oops, something went wrong!', error); });

Convert DOM to SVG

This feature allows you to convert a DOM node into an SVG image. The code sample demonstrates how to capture an element and append the resulting SVG image to the document body.

domtoimage.toSvg(document.getElementById('my-node')).then(function (dataUrl) { var img = new Image(); img.src = dataUrl; document.body.appendChild(img); }).catch(function (error) { console.error('oops, something went wrong!', error); });

Other packages similar to dom-to-image-more

Keywords

FAQs

Package last updated on 16 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc