1

I have a Three JS application that involves CSS 3D Renderer. I am using html2canvas library to take screenshots of document.body.

The only problem is that it takes a screenshot of everything except the CSS 3D Renderer.

Here's the code for taking the screenshot:

window.addEventListener("keyup", function(e){

    //Listen to 'P' key
    if(e.which !== 80) return;

    html2canvas(document.body, {
      onrendered: function(canvas) {
        var img = canvas.toDataURL();
        window.open( img , 'Final' );
      }
    });
});

For a demo, please visit:

http://nobelbrothers.com/test/CanvasShot and http://nobelbrothers.com/CanvasShot

Note: Press P to take a screenshot (You need to turn off pop-up blocker).

Thank you

gman
  • 100,619
  • 31
  • 269
  • 393
Adnan Zahid
  • 573
  • 1
  • 10
  • 38

1 Answers1

0

I implemented this feature thanks to the file saver js lib

 <script type="text/javascript" src="js/filesaver.js"></script>

window.addEventListener("keyup", function(e){

    //Listen to 'P' key
    if(e.which !== 80) return;
    Render.domElement.toBlob(function(blob) {
        saveAs(blob, "Final");
    });
});
thesmash
  • 599
  • 6
  • 9