var img = new Image();
img.src = canvas.toDataURL();
document.body.appendChild(img);
const renderTask = page.render(renderContext).promise;
renderTask.then(() => {
var img = new Image();
img.src = canvas.toDataURL();
img.onload = () => document.body.appendChild(img);
});