> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/5-dokumenty-i-zaloczniki/generator-dokumentow-documentgenerator.md).

# Document generator - DocumentGenerator

The component is used to generate documents (PDF) based on XSL-FO templates. It also allows saving generated documents to the DMS system, as well as passing their content as a Base64-encoded string.

## Component properties

<table><thead><tr><th width="240.683349609375">Eximee Designer property</th><th width="183.1165771484375">Attribute name in the Source</th><th>Description</th></tr></thead><tbody><tr><td><strong>Document list</strong></td><td>items</td><td>List of documents to generate.</td></tr><tr><td><strong>Save to DMS</strong></td><td>saveToDms</td><td>Flag indicating whether the document should be saved to DMS (default value "true").</td></tr><tr><td><strong>Save to DMS after abandoning the request</strong></td><td>saveToDmsOnAbandon</td><td>Flag indicating whether the document should be saved to DMS after abandoning the request (default value "false").</td></tr><tr><td><strong>Passing the document content in </strong><em><strong>base64 String</strong></em></td><td>fileContentInValue</td><td>Flag indicating whether the value of the component will pass the content of the generated file in the form of <em>base64 String</em>.</td></tr></tbody></table>

> More information about component properties: [Common component properties](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/praca-z-komponentami-bazowymi/wspolne-wlasciwosci-komponentow.md)

## List of documents to generate

The component configuration is added in the **Source** tab. Sample configurations:

{% code title="Example 1 - Configuration when the data comes from form fields" %}

```xml
<p1:GesDocumentGenerator id="GesDocumentGenerator1" inheritLayout="true">
  <p1:GesDocumentGenerator.layoutData>
    <GridData horizontalAlignment="FILL" horizontalSpan="16"/>
  </p1:GesDocumentGenerator.layoutData>
  <data:DocumentGeneratorItems>
    <data:DocumentGeneratorItem generatorName="fop" fileName="my_file.pdf" documentTemplate="my_temp.xsl-*"/>
  </data:DocumentGeneratorItems>
</p1:GesDocumentGenerator>
```

{% endcode %}

{% code title="Example 2 - Configuration when the data comes from the xmlDocument variable" %}

```xml
<p1:GesDocumentGenerator id="GesDocumentGenerator1" inheritLayout="false">
  <data:ListeningOn>
    <data:ListenField id="xmlDocument"/>
  </data:ListeningOn>
  <data:ClearOn/>
  <p1:GesDocumentGenerator.layoutData>
    <ns6:GridData horizontalAlignment="LEFT" horizontalSpan="6" verticalAlignment="CENTER"/>
  </p1:GesDocumentGenerator.layoutData>
  <data:DocumentGeneratorItems>
    <data:DocumentGeneratorItem generatorName="fopFromVariable" fileName="my_file.pdf" documentTemplate="my_template.xsl-*"/>
  </data:DocumentGeneratorItems>
</p1:GesDocumentGenerator>
```

{% endcode %}

The sample configurations for documents to be generated are shown above. The parameter **generatorName** specifies the name of the document generator to be used to generate the document; in the next parameter we specify the file name (**fileName**), which will be presented to the user, and the last one the name of the document template available in the repository (**documentTemplate** in the TEMPLATE\_NAME-VERSION format).

{% hint style="warning" %}
Document generation takes place according to the dependency graph flow — therefore remember to set the listening list appropriately.

If the component is located on the last page of the request, where there are also fields passed to the generated document, then the component must listen to something that changes on page exit. Examples:

* Creating an Exit Service with a regular Echo Service (e.g. giving the value true) and assigning the result of the Echo Service to a variable that the document generator will then listen to.
* Adding listening in GesDocumentGenerator to a predefined variable **currentPageMid**.
  {% endhint %}

## Illustration of the component

![Figure 1. Example appearance of the component on the application](/files/984e69bfde93b5a83245809b5ae840872413292f)

{% hint style="info" %}
Demo application: demoDocuments
{% endhint %}


---

# 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://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/5-dokumenty-i-zaloczniki/generator-dokumentow-documentgenerator.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.
