54934623d5015b716f99b2cdd41cb8543726439f
[yaffs-website] / commands / render / render.md
1 render
2 ========
3 This command allows you render a web page to an image buffer and saves it as the specified filename given in the command arguments.
4
5 The image format will be automatically set based on the filename extension, the current supported formats are:
6 * PNG
7 * GIF
8 * JPEG
9 * PDF
10
11 ##Commmand arguments:
12   1. path
13     * The path where you want the file to be saved
14   2. full
15     * `true` for rendering all the page, `false` if we are going to use a selection
16   3. selector
17     * If full is `false` then you have to specify the CSS selection you want to render, internally we will use document.querySelector.
18
19 ##Full page render request:
20 ```json
21 {
22     "name" : "render",
23     "args": [
24       "/path/to/the/file.png", true, null
25     ]
26 }
27 ```
28 ##Part of a page render request:
29 ```json
30 {
31     "name" : "render",
32     "args": [
33       "/path/to/the/file.png", false, "body > div.wrapper > div.main.clearfix"
34     ]
35 }
36
37 ```
38
39 ##Response:
40 A successful render command will reply with:
41 ```json
42 {
43   "response": true
44 }
45 ```