How to use the html-to-image.toPng function in html-to-image

To help you get started, we’ve selected a few html-to-image examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mariusbrataas / flowpoints.js / demo / src / index.js View on Github external
onClick={() => {
                  htmlToImage.toPng(this.diagramRef).then(function (dataUrl) {
                    var img = new Image();
                    img.src = dataUrl;
                    var link = document.createElement('a');
                    link.download = 'diagram.png';
                    link.href = dataUrl;
                    link.click();
                  })
                }}>
                Export PNG
github explooosion / browndust-share / src / container / Toolbar.js View on Github external
onDownloadClick() {
    const size = this.state.downloadSizeSelected !== 4 ? this.state.downloadSize
      .find(d => d.value === this.state.downloadSizeSelected).name
      : Number(this.state.downloadSizeCustom);

    if (Number(size) <= 0) return;
    toPng(this.props.dataset.ref.current)
      .then(async dataUrl => {
        const newDataUri = await resizeImageURL(dataUrl, size);
        const a = document.createElement('a');
        a.href = newDataUri;
        a.download = `output-${moment().format('YYYYMMDDTHmmss')}.png`;
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
      });
  }
github mariusbrataas / flowpoints_ml / src / sidebar / MiscTab.js View on Github external
onClick={(e) => {
                htmlToImage.toPng(props.diagramRef).then(function (dataUrl) {
                  var img = new Image();
                  img.src = dataUrl;
                  var link = document.createElement('a');
                  link.download = 'diagram.png';
                  link.href = dataUrl;
                  link.click();
                })
              }}>
              Export png

html-to-image

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

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis