source: other-projects/FileTransfer-WebSocketPair/Themes/themebuilder/bin/phantomjs-1.9.2-windows/examples/printmargins.coffee@ 31525

Last change on this file since 31525 was 31525, checked in by ak19, 7 years ago

Nathan provided more stuff: Themes folder contains Sencha's Themebuilder which generates GXT Themes. It includes the .theme and generated .jar files for the project theme.

File size: 839 bytes
Line 
1page = require("webpage").create()
2system = require("system")
3if system.args.length < 7
4 console.log "Usage: printmargins.js URL filename LEFT TOP RIGHT BOTTOM"
5 console.log " margin examples: \"1cm\", \"10px\", \"7mm\", \"5in\""
6 phantom.exit 1
7else
8 address = system.args[1]
9 output = system.args[2]
10 marginLeft = system.args[3]
11 marginTop = system.args[4]
12 marginRight = system.args[5]
13 marginBottom = system.args[6]
14 page.viewportSize =
15 width: 600
16 height: 600
17
18 page.paperSize =
19 format: "A4"
20 margin:
21 left: marginLeft
22 top: marginTop
23 right: marginRight
24 bottom: marginBottom
25
26 page.open address, (status) ->
27 if status isnt "success"
28 console.log "Unable to load the address!"
29 else
30 window.setTimeout (->
31 page.render output
32 phantom.exit()
33 ), 200
Note: See TracBrowser for help on using the repository browser.