“SVG zu PNG Base64 JavaScript” Code-Antworten

SVG in Base64 JavaScript konvertieren

var s = new XMLSerializer().serializeToString(document.getElementById("svg"))
var encodedData = window.btoa(s);
Undefined

Knotenbasis64 SVG bis PNG

var fabric = require('fabric').fabric;
var canvas = new fabric.createCanvasForNode(100, 100);
var svgStr = '<svg height="100" width="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>';

fabric.loadSVGFromString(svgStr, function(objects, options) {
  var obj = new fabric.PathGroup(objects, options);
  canvas.add(obj);            
  console.log('<img src="' + canvas.toDataURL() + '" />');
});
El-Dessouki

SVG zu PNG Base64 JavaScript

var fabric = require('fabric').fabric;
var canvas = new fabric.createCanvasForNode(100, 100);
var svgStr = '<svg height="100" width="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>';

fabric.loadSVGFromString(svgStr, function(objects, options) {
  // PathGroup changed to Group in newer version
  var obj = new fabric.Group(objects, options);
  canvas.add(obj);            
  console.log('<img src="' + canvas.toDataURL() + '" />');
});
p2sias

Knotenbasis64 SVG bis PNG

sudo npm install fabric
El-Dessouki

Ähnliche Antworten wie “SVG zu PNG Base64 JavaScript”

Fragen ähnlich wie “SVG zu PNG Base64 JavaScript”

Weitere verwandte Antworten zu “SVG zu PNG Base64 JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen