metalaureate
metalaureate

Reputation: 7732

Using phantomjs to capture partial page contents

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?

Upvotes: 0

Views: 717

Answers (1)

andygoestohollywood
andygoestohollywood

Reputation: 1285

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);
  }
});

Upvotes: 1

Related Questions