0

Does anyone know how to get phantomjs to screen capture partial page contents of a 3rd party web page?

For example, suppose a bookmarklet might figure out the element to capture, to send back to the server for snapping.

Is there a way to get phantomjs to render the contents of just that element?

4

1 回答 1

1

It sounds like you need something to render a screenshot on the client, rather than on the server.

html2cancas let's you do what you want, but with some limitations.

You can get the script here:http://html2canvas.hertzen.com/

Include html2canvas and do:

var element =     
document.getElementById("myEl");
html2canvas(myEl, {
    onrendered: function(canvas) {
        document.body.appendChild(canvas);
  }
});
于 2013-10-08T19:44:12.263 回答