Some issues capturing web page image with, node-webshot

大憨熊 提交于 2019-12-24 12:54:58

问题


I have a web application, written in node.js with express framework, and Twitter Boostrap 3 in front end, and i'm using this module node-webshot in order to save a state of a page in png format, when a users logout from my site, later show to the user a little thumbnail of, his last state of the page.

This module, works really nice, but i'm experimenting some issues, examples:

On localhost environment (OSX 10.9):

When i put my application on my Digital Ocean VPS (GNU/Linux -> CentOS 6.5).

As you can see, are two differents issues, in the first one fail to get the glyphicons and in the second one fail with .... character encoding maybe?.

Here is the portion of my code that save the image, and works perfect, except by this two issues.

var options = {
  quality : 50,
};

webshot(refererURL, './public/assets/img/lastScreen.png',
  options, function(err) {

  if(err) console.log('Error: some in screenshoot' , err);
  res.render('select_sys');
});

In the module docs, says this works with phantomJS, some ideas?

Thanks in advance.


回答1:


I had the same issue with node-webshot. Rather than giving up on node-webshot entirely, I updated the module's phantomjs to phantomjs 2.0. Then I installed the fonts, and whallah. PhantomJS 2.0 just needs to be moved into webshot/node_modules/phantomjs/lib, and /bin directories to be safe. Hope this works for you!



来源:https://stackoverflow.com/questions/24967550/some-issues-capturing-web-page-image-with-node-webshot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!