Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / phantomjs / lib / phantom / examples / printmargins.coffee
1 page = require("webpage").create()
2 system = require("system")
3 if 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
7 else
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