> For the complete documentation index, see [llms.txt](https://developers.newbluefx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.newbluefx.com/api-examples/sample-controllers-tour/04-render-a-preview.md).

# Render a Preview

You might write a controller that needs to show what a title will look like with certain variable settings before going live with it.

The “[snapshot](/captivate-api/all-commands-reference/status-information.md#api-command-getsnapshot)” command does just that. With it, you can set variables and request a preview rendering.

This example shows how to use the snapshot command to preview:

```javascript
scheduler.scheduleCommand(
  'getSnapshot',
  { input: inputName, encode: 1, scaleToFit: 1, width: 800, height: 300, sync: 1 },
  settings.variables,
  (resultString) => {
    console.log(resultString);
  }
);
```

| Parameter            | Description                                                                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `encode`             | tells snapshot to return the png image as a byte-encoded string.                                                                               |
| `width` and `height` | set the size of the returned image.                                                                                                            |
| `scaleToFit`         | tells it to scale the image so it best fits the width and height, while maintaining the correct aspect ratio.                                  |
| `sync`               | tells snapshot to perform the work synchronously and return the data in the callback, otherwise, the data will come in a notification message. |

And then, once you like what you see, safely update the live title using the `scheduleAction` command:

```javascript
scheduler.scheduleAction('update', inputName, '', settings.variables);
```

<figure><img src="/files/kC1HCSoxmIjmhheGbDRJ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.newbluefx.com/api-examples/sample-controllers-tour/04-render-a-preview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
