I'm trying to create an image snaphot of my website using node-weshot which depends on phantomjs. It work as expected on my local machine, but when I deploy it on a live server. It just keeps firing the callback saying that image is generated. But underneath, the process is still generating the image. (i.e) The filename is generated, but it has no size and contents. After 10 minutes the file will be populated with the image data. However the fonts did not render correctly.
here is the screenshot:
and heres my webshot code:
var options = {
screenSize: {
width: 403,
height: 403
},
shotSize: {
width: 403,
height: 403
},
script: function() {
$(function() {
window.callPhantom('takeShot');
});
},
takeShotOnCallback: true
};
webshot(baseUrl+frame_url, path, options, function(err) {
if(err){
return res.json({ok:false, error:err.error || err});
}
return res.json({image:baseUrl+img,ok:true});
});
So technically I have 2 problems here:
- Webshot returns the callback even though the image generation is not finished yet.
- The generated image does not render the fonts correctly. (Im using Google fonts here).
Is there any of fixing the issue? I can see that this is related to How do you take a screenshot of an angularjs app?
Or are there any good alternatives to node-webshot and phantomjs?