Skip to content

Instantly share code, notes, and snippets.

@aloncarmel
Created January 23, 2014 15:20
Show Gist options
  • Save aloncarmel/8580296 to your computer and use it in GitHub Desktop.
Save aloncarmel/8580296 to your computer and use it in GitHub Desktop.
A try to capture chrome pages using the pagecapture and create an image of them. NOT working.
chrome.pageCapture.saveAsMHTML({'tabId':1654}, function(mhtmlData){
var reader = new FileReader();
reader.readAsText(mhtmlData);
reader.onloadend = function() {
var html = reader.result;
d = document.createElement('div');
$(d).append(reader.result);
html2canvas(d, {
onrendered: function(canvas) {
var context = canvas.getContext("2d");
var imgurl = canvas.toDataURL("image/png");
console.log(imgurl);
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment