Skip to content

Commit

Permalink
page background defaults to white
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Aug 26, 2013
1 parent dbb0f39 commit 7488202
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ containing the image.

If no `fn` is provided, a thunk/continuable is returned.

If the page has a transparent background, it will be set to `white` before
capturing.

## Installation

Make sure you have a working installation of
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var screenshot = require('./');
var fs = require('fs');

screenshot('http://google.com/')
screenshot('http://ghub.io/')
.width(800)
.height(600)
.capture(function(err, img) {
Expand Down
Binary file modified example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions script/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ page.onError = noop;
page.open(url, function (status) {
if (status !== 'success') throw new Error('Unable to load');
window.setTimeout(function () {
page.evaluate(function() {
if (!document.body.style.background) {
document.body.style.backgroundColor = 'white';
}
});
console.log(page.renderBase64(format));
phantom.exit();
}, timeout);
Expand Down

0 comments on commit 7488202

Please sign in to comment.