I'm creating an OpenLayers draw application where I let users draw shapes and then I allow them to print maps on pdf by zooming into the drawn shape. My current code is working for - Draw Geometry, Zoom to the geometry. For printing, I'm currently using
map.once('postcompose', function(e){
var canvas = e.context.canvas;
data = canvas.toDataURL("image/jpg");
doc.addImage(data, "jpg", 10, 50, 190, 120);
})
but the problem is it doesn't wait for complete loading of basemap, because of which I'm getting blurred background.
how can I fix this?