Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to screenshot website in JavaScript client-side / how Google did it? (no need to access HDD) [duplicate]

This answers your problem.

You can use JavaScript/Canvas to do the job but it is still experimental.

Update:

There is a library for this now https://html2canvas.hertzen.com/


I needed to snapshot a div on the page (for a webapp I wrote) that is protected by JWT's and makes very heavy use of Angular.

I had no luck with any of the above methods.

I ended up taking the outerHTML of the div I needed, cleaning it up a little (*) and then sending it to the server where I run wkhtmltopdf against it.

This is working very well for me.

(*) various input devices in my pages didn't render as checked or have their text values when viewed in the pdf... So I run a little bit of jQuery on the html before I send it up for rendering. ex: for text input items -- I copy their .val()'s into 'value' attributes, which then can be seen by wkhtmlpdf