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

311
Views
Unable to render external images in html2canvas

New to javascript, please help me to render external images in html2canvas script. Do I have to use useCORS? If yes, where? I have tried rendering images from css and html tags too but its not reflecting.

Also console error: Uncaught (in promise) DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

const elm = document.querySelector(".convert");
html2canvas(elm).then(function(canvas) {
  document.querySelector(".result");
  document.body.appendChild(canvas);

  let cvs = document.querySelector("canvas");
  let a = document.querySelector(".a");
  a.href= cvs.toDataURL();
  a.download="example.png";
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I also had the same problem

html2canvas(this.PrintOrderID.nativeElement, {
  scale: 2,
  width: mywindow!.innerHeight,
  height: mywindow!.innerWidth,
  useCORS: true,
  allowTaint : true
}).then((canvas) => {
  mywindow!.document.body.appendChild(canvas);
})
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!