Skip to content

Instantly share code, notes, and snippets.

Created July 10, 2014 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b67c7ef28d00f2a1aa62 to your computer and use it in GitHub Desktop.
Save anonymous/b67c7ef28d00f2a1aa62 to your computer and use it in GitHub Desktop.
var webpage = require('webpage');
var page = webpage.create();
page.open('http://example.com/', function(status){
var b64 = page.renderBase64('PNG');
//console.log(b64);
page.evaluate(function(b64){
document.write('<img src="data:image/png;base64,'+b64+'">');
}, b64);
page.render('test08_b64example.pdf');
page.render('test08_b64example.png');
//console.log(page.content);
console.log("DONE");
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment