0

How I can convert SVG element to PNG or JPG File then can send PNG or JPG file to the server I create SVG element like this:

var xmls = "http://www.w3.org/2000/svg";
var svgElem = document.createElementNS(xmls,"svg");
svgElem.setAttributeNS(null,"viewBox","0 0 200 200");
svgElem.setAttributeNS(null,"width","200");
svgElem.setAttributeNS(null,"height","200");
svgElem.style.backgroundImage = "url(imageUrl)";

How I can convert it to the PNG or JPG and send it as a File

  • 3
    Does this answer your question? [Convert SVG to image (JPEG, PNG, etc.) in the browser](https://stackoverflow.com/questions/3975499/convert-svg-to-image-jpeg-png-etc-in-the-browser) – some name Oct 26 '21 at 04:54

0 Answers0