rasterize.js: Rasterize HTML/XML/SVG document to an image.

1.0
Ariya Hidayat 2010-12-31 18:27:15 -08:00
parent 37d67f0395
commit c5de293368
1 changed files with 16 additions and 0 deletions

16
examples/rasterize.js Normal file
View File

@ -0,0 +1,16 @@
if (phantom.storage.length === 0) {
if (phantom.arguments.length !== 2) {
phantom.log('Usage: rasterize.js URL filename');
phantom.exit();
} else {
var address = phantom.arguments[0];
phantom.storage = 'rasterize';
phantom.viewportSize = { width: 600, height: 600 };
phantom.open(address);
}
} else {
var output = phantom.arguments[1];
phantom.sleep(200);
phantom.render(output);
phantom.exit();
}