Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am rendering multiple images as one into a canvas. I have a scenario where I have to create and send it to the server. I am converting the canvas image to base64 and sending as a post data to server.

But the base64 is not coming proper as the canvas is not getting completely rendered by the time the service call happens.

I have tried time out as below which is working but when the network is slow/rendering is slow it fails as expected.

setTimeout(function () {
base64 = canvas.toDataURL();
}, 1000);

Is there any way with help of which I will be able to make sure that the canvas has finished rendering?

What I have tried:

I have tried time out as below which is working but when the network is slow/rendering is slow it fails as expected.

setTimeout(function () {
base64 = canvas.toDataURL();
}, 1000);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900