How to use html-to-image - 5 common examples

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
github county-of-simcoe-gis / SimcoeCountyWebViewer / src / sidebar / MenuButton.jsx View on Github external
window.map.once("rendercomplete", function() {
      htmlToImage.toBlob(window.map.getTargetElement()).then(function(blob) {
        window.saveAs(blob, "map.png");
      });
    });
github hammerlab / pileup.js / src / main / pileup.js View on Github external
toSVG(filepath: ?string): Promise {
        if (reactElement === null) {
          throw 'Cannot call toSVG on a destroyed pileup';
        }

        return htmlToImage.toSvgDataURL(el)
          .then(function (svg) {
              if (filepath != null) {
                  window.saveAs(svg, filepath);
              }
              return svg;
          });
    },
    destroy(): void {

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