Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
how to convert svg inline element to canvas?

heloo man and women

in my web app, there is a svg element (not file). i want to convert it to canvas. (just like screenshot)

enter image description here

can you share some practics?

this is a node project. so I do not want to import script tag

can you help?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I've trying, and you could use something like the following:

const canvas = document.getElementById("theCanvas");
const svg = document.getElementById("theSvg");
const context = canvas.getContext('2d');
const image = new Image();
image.addEventListener('load', () => {
    context.drawImage(image, 0, 0, canvas.width, canvas.height);
}, false);
image.src = URL.createObjectURL(new Blob([svg.outerHTML], {type: 'image/svg+xml'}));
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!