Mercurial > hg > nodescore
comparison rasterize.js @ 32:c4719d1b7633
svg mods
| author | tzara <rc-web@kiben.net> |
|---|---|
| date | Sun, 19 Aug 2012 21:44:23 +0000 |
| parents | e4d2a8eb1450 |
| children | 7f0485e0d0ff |
comparison
equal
deleted
inserted
replaced
| 31:e4d2a8eb1450 | 32:c4719d1b7633 |
|---|---|
| 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: 400 } | 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: 1000, height: 400 }; | 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) { |
