> For the complete documentation index, see [llms.txt](https://docs.hubyte.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hubyte.de/pdf-dokumenten-template-bearbeiten/english-documentation/vorschau.md).

# Preview

So you don't have to check your customizations by first creating a real document, the plugin offers a **live preview**. It generates the document as a PDF based on a real order and opens it in a new tab.

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

## Generating a preview

You will find the preview function in the header area of the document configuration (next to the action buttons), once the configuration has been saved:

1. **Select order** – Use the "Select order (default: latest)" field to choose the order the preview should be generated with. If you make no selection, the **latest order** is used automatically.
2. **Preview** – Click the **Preview** button. The PDF is generated and opened in a new browser tab.

> **Important:** Save your changes before generating the preview. The preview renders the currently saved state of the document.

## Requirements

* There must be **at least one order** in the shop. Otherwise the message appears: *"No order found. At least one order is required to generate a preview."*
* The document configuration must be saved (not a new, unsaved document).

## Troubleshooting

If generation fails, the administration shows an error message with the concrete cause (e.g. a Twig syntax error in your template). Common causes:

| Message / symptom                     | Possible cause & solution                                                  |
| ------------------------------------- | -------------------------------------------------------------------------- |
| Twig/syntax error in the message      | Check your Twig template for unclosed tags or typos                        |
| "The preview could not be generated." | General error – check the template, the selected order and the server logs |
| "No order found."                     | Create at least one order or select a specific order                       |

> **Tip:** The preview is ideal for quickly testing Twig customizations to the line items table and summary, as template errors are shown directly as a message.
