Mercurial > hg > nodescore
comparison rasterize.js @ 43:7f0485e0d0ff
updates via ljubljana
author | tzara <rc-web@kiben.net> |
---|---|
date | Sat, 08 Sep 2012 08:25:19 +0000 |
parents | c4719d1b7633 |
children |
comparison
equal
deleted
inserted
replaced
42:49c94f63b8b0 | 43:7f0485e0d0ff |
---|---|
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: 1000, height: 450 } | 7 page.clipRect = { top: top, left: 0, width: 1000, height: 330 } |
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: 1000, height: 450 }; | 18 page.viewportSize = { width: 1000, height: 330 }; |
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: '0cm' }; | 22 : { format: system.args[3], orientation: 'portrait', margin: '0cm' }; |
23 } | 23 } |