> 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="https://2284285836-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXkMvk0MrY3BcyplZ0pf7%2Fuploads%2FuueUPwrwZVx9lF39UwRO%2Fdownload-3.png?alt=media&amp;token=222e2d0b-aef8-40f0-bd84-7ed563436411" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
