Mercurial > hg > nodescore
comparison rasterize.js @ 33:5088859ace72
Merge branch 'master' of git://gitorious.org/nodescore/nodescore
Conflicts:
nodescore
www/m/thumbs/1.png
www/m/thumbs/2.png
www/m/thumbs/3.png
www/m/thumbs/4.png
www/m/thumbs/5.png
www/m/thumbs/6.png
author | tzara <rc-web@kiben.net> |
---|---|
date | Sun, 19 Aug 2012 22:59:48 +0100 |
parents | c4719d1b7633 |
children | 7f0485e0d0ff |
comparison
equal
deleted
inserted
replaced
30:0123b4602f8e | 33:5088859ace72 |
---|---|
2 system = require('system'), | 2 system = require('system'), |
3 address, output, size; | 3 address, output, size; |
4 | 4 |
5 top = system.args[3]; | 5 top = system.args[3]; |
6 | 6 |
7 page.clipRect = { top: top, left: 0, width: 1280, height: 800 } | 7 page.clipRect = { top: top, left: 0, width: 1000, height: 450 } |
8 | 8 |
9 if (system.args.length < 3 || system.args.length > 5) { | 9 if (system.args.length < 3 || system.args.length > 5) { |
10 console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); | 10 console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]'); |
11 console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); | 11 console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"'); |
12 phantom.exit(1); | 12 phantom.exit(1); |
13 } else { | 13 } else { |
14 address = system.args[1]; | 14 address = system.args[1]; |
15 output = system.args[2]; | 15 output = system.args[2]; |
16 | 16 |
17 | 17 |
18 page.viewportSize = { width: 800, height: 800 }; | 18 page.viewportSize = { width: 1000, height: 450 }; |
19 if (system.args.length > 4 && system.args[2].substr(-4) === ".pdf") { | 19 if (system.args.length > 4 && system.args[2].substr(-4) === ".pdf") { |
20 size = system.args[4].split('*'); | 20 size = system.args[4].split('*'); |
21 page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' } | 21 page.paperSize = size.length === 2 ? { width: size[0], height: size[1], margin: '0px' } |
22 : { format: system.args[3], orientation: 'portrait', margin: '1cm' }; | 22 : { format: system.args[3], orientation: 'portrait', margin: '0cm' }; |
23 } | 23 } |
24 if (system.args.length > 5) { | 24 if (system.args.length > 5) { |
25 page.zoomFactor = system.args[5]; | 25 page.zoomFactor = system.args[5]; |
26 } | 26 } |
27 page.open(address, function (status) { | 27 page.open(address, function (status) { |