> 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="https://236649677-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnEz80MdqhT4eQNSWROtZ%2Fuploads%2Ft0VJWffGiiuEOetZDbDC%2Fsw6-plugin-documents-preview.png?alt=media&amp;token=fb589ed1-50d4-4486-8b5f-8ecd863e0118" 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.
