Dom-to-image: Uncaught (in promise)

Created on 25 Jan 2018  路  6Comments  路  Source: tsayen/dom-to-image

function feedback() {
$("#suggestion").val("");
var feedBackNode = document.body;
domtoimage.toPng(feedBackNode).then(function (dataUrl) {
imgDataUrl = dataUrl;
var widthO = feedBackNode.offsetWidth;
var heightO = feedBackNode.offsetHeight;
var v = 1;
var max = 550;
if (widthO > heightO) {
if (widthO > max) {
v = max / widthO;
}
} else {
if (heightO > max) {
v = max / heightO;
}
}
var img = new Image();
img.src = dataUrl;
$("#feedback").empty();
$("#feedback").append($(img).css("width", widthO * v).css("height", heightO * v));
})
$("#feedbackModal").modal("show");
}

image

  • [ ] Chrome 49+
  • [ ] Firefox 45+

All 6 comments

How did you solove this problem?

same issue in 2020

Any solution to this issue?

same in 2021 there s no way to debug this error

In my case, this was happening because when I was converting multiple dom elements to image in parallel. The issue got resolved after I modified the code and made it sequential.

Same here - not clear why Uncaught (in promise). Not clear why this error happens

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sumigoma picture sumigoma  路  4Comments

XiNiHa picture XiNiHa  路  4Comments

unit57 picture unit57  路  6Comments

ezramod picture ezramod  路  5Comments

distroyq picture distroyq  路  6Comments