Sha256: 772aab5a79b56051a9ea2f7a5d3900088c794b7b237a218aa0833fe9b9081450

Contents?: true

Size: 991 Bytes

Versions: 15

Compression:

Stored size: 991 Bytes

Contents

/*global phantom */

var page = require('webpage').create(),
    system = require('system'),
    address, output, size;

if (system.args.length < 3 || system.args.length > 5) {
    console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]');
    console.log('  paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
    phantom.exit(1);
} else {
    address = system.args[1];
    output = system.args[2];
    page.viewportSize = { width: 1000, height: 700 };
    if (system.args.length > 3) {
        size = system.args[3].split('*');
        page.viewportSize = { width: size[0], height: size[1] };
    }

    page.open(address, function (status) {
        if (status !== 'success') {
            console.log('Unable to load the address!');
            phantom.exit();
        } else {
            window.setTimeout(function () {
                page.render(output);
                phantom.exit();
            }, 200);
        }
    });
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
shutterbug-0.2.5 lib/shutterbug/rasterize.js
shutterbug-0.2.1 lib/shutterbug/rasterize.js
shutterbug-0.2.0 lib/shutterbug/rasterize.js
shutterbug-0.1.2 lib/shutterbug/rasterize.js
shutterbug-0.1.1 lib/shutterbug/rasterize.js
shutterbug-0.1.0 lib/shutterbug/rasterize.js
shutterbug-0.0.11 lib/shutterbug/rasterize.js
shutterbug-0.0.10 lib/shutterbug/rasterize.js
shutterbug-0.0.9 lib/shutterbug/rasterize.js
shutterbug-0.0.8 lib/shutterbug/rasterize.js
shutterbug-0.0.7 lib/shutterbug/rasterize.js
shutterbug-0.0.6 lib/shutterbug/rasterize.js
shutterbug-0.0.4 lib/shutterbug/rasterize.js
shutterbug-0.0.3 lib/shutterbug/rasterize.js
shutterbug-0.0.2 lib/shutterbug/rasterize.js