Version 1
[yaffs-website] / vendor / jcalderonzumba / gastonjs / docs / api / commands / render / render_base64.md
1 render_base64
2 =============
3 This command allows you render a web page to an image buffer and returns the base64 encoded representation of the image.
4
5 The supported formats are:
6
7 * PNG
8 * GIF
9 * JPEG
10
11 ##Commmand arguments:
12   1. image_format
13   2. full
14     * `true` for rendering all the page, `false` if we are going to use a selection
15   3. selector
16     * If full is `false` then you have to specify the CSS selection you want to render, internally we will use document.querySelector.
17
18 ##Full page render request:
19 ```json
20 {
21     "name" : "render_base64",
22     "args": [
23       "png", true, null
24     ]
25 }
26 ```
27 ##Part of a page render request:
28 ```json
29 {
30     "name" : "render_base64",
31     "args": [
32       "png", false, "body > div.wrapper > div.main.clearfix"
33     ]
34 }
35
36 ```
37
38 ##Response:
39 A successful render_base64 command will reply with:
40 ```json
41 {
42   "response": "iVBORw0KGgoAAAANSUhEUgAABAAAAACYCAYAAAB6Z5u+AAAABHNCSVQICAgIfAh......"
43 }
44 ```