“svg ke png base64 javascript” Kode Jawaban

Konversi SVG ke Base64 JavaScript

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

node base64 svg ke 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 ke 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

node base64 svg ke png

sudo npm install fabric
El-Dessouki

Jawaban yang mirip dengan “svg ke png base64 javascript”

Pertanyaan yang mirip dengan “svg ke png base64 javascript”

Lebih banyak jawaban terkait untuk “svg ke png base64 javascript” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya