> ## Documentation Index
> Fetch the complete documentation index at: https://helpdocs.gavel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Output Settings

> Control output file types, hide documents from end users, send them by email automatically, and apply conditional logic to document generation.

After you attach document templates to a workflow, you can configure how Gavel handles the generated output. These settings control the file format of the finished documents, who sees them and when, which documents generate under what conditions, and where they are delivered. You manage all of these options from the **Document Templates** tab of your workflow.

## Output file type

<Accordion title="Word templates: choosing Word, PDF, or both">
  When your template is a `.docx` file, Gavel can generate the output as a Word file, a PDF, or both. By default, the PDF format is produced.

  To change the file type:

  1. Open your workflow and go to **Document Templates**.
  2. Click on Details under the Document Name
  3. Select your preferred output: **Word only**, **PDF only**, or **Both**.

  This setting determines which file types appear on the final screen of your workflow when the documents are displayed to the user. File types included in automated emails are configured separately.

  All PDF template files always generate PDF output — this option only applies to Word-based templates.
</Accordion>

## Displaying documents to users

By default, Gavel shows all generated documents to the end user at the end of the questionnaire. You can change this behavior in several ways.

<AccordionGroup>
  <Accordion title="Hide documents from the end user">
    If you do not want the user who filled out the questionnaire to see the generated documents — for example, if you are generating documents for internal review only — you can suppress the document display screen.

    1. Open your workflow and go to **Document Templates**.
    2. Click on the side bar **Sharing.**
    3. Check **Do not display finalized documents to workflow taker**.
    4. Check **Send finalized documents to email address** and enter the email address where the documents should go.
    5. Click **Save**.

    You can still view completed documents in the **Data Manager** if you are on the Standard, Pro, or Scale tier.
  </Accordion>

  <Accordion title="Display documents conditionally">
    You can use logic to control which documents generate and display based on questionnaire answers. This lets you attach multiple possible output documents to one workflow and generate only the ones relevant to each user's situation.

    To set up conditional document generation:

    1. Open your workflow and go to **Document Templates**.
    2. Make sure all possible output documents are attached to the workflow. You can attach the same document to multiple workflows.
    3. Select **Logic** on the left side of the Document Templates tab.
    4. Set default documents that generate every time.
    5. Add rules that determine when each additional document generates.

    For example, you might have four documents that always generate, plus a Living Trust document that only generates when the user selects "Revocable Living Trust" in a multi-select question. **If no logic is set, all attached documents generate.**
  </Accordion>
</AccordionGroup>

## Sharing documents via email

<AccordionGroup>
  <Accordion title="Automated emails at workflow completion">
    You can configure Gavel to automatically send the finished documents to an email address each time the workflow is run. You can specify a fixed email address or use the value stored in an email variable from the questionnaire (so the documents go directly to the person who filled out the form).

    A PDF copy of each document is included in the email by default. If your documents were generated from Word templates, you can also choose to include an editable `.docx` version.

    Automated emails are sent from `no-reply@mail.docautomation.org` with the sender name **Gavel** by default. Scale customers can configure a custom sender using a Mailgun account — contact [help@gavel.io](mailto:help@gavel.io) with your Mailgun email, API key, and domain.

    You can customise the subject line and body of automated emails from the workflow settings.
  </Accordion>

  <Accordion title="End-user self-serve email">
    If documents are displayed to the end user at the end of the workflow, the generated documents page includes a section where the user can email themselves a copy. If the user is logged into a Gavel account, their email address populates the field automatically.
  </Accordion>
</AccordionGroup>

## Generate Multiple (per repeating item)

If your workflow has a repeating item and you want to produce a separate copy of a document for each instance of that item — for example, one document per party or one document per asset — you must mark the template as **Generate Multiple** in the Document Templates tab.

<Warning>
  If a template uses the Generate Multiple syntax in the document body but is not marked as Generate Multiple in the Output Documents tab, the workflow will produce an error. Always make sure the setting and the template syntax are in sync.
</Warning>

To enable Generate Multiple:

1. Open your workflow and go to **Document Templates**.
2. Click on the document's name.
3. Enable the **Generate Multiple** option.

## Quick reference: settings per document

| Setting                | Where to find it                              | What it controls                                            |
| ---------------------- | --------------------------------------------- | ----------------------------------------------------------- |
| Output file type       | Click the document name in Document Templates | Word, PDF, or both for Word-based templates                 |
| Hide from end user     | Document Templates tab, checkbox              | Whether the questionnaire taker sees the finished documents |
| Send to email          | Document Templates tab, email field           | Auto-sends documents to a specified address on completion   |
| Conditional generation | Document Templates > Logic                    | Which documents generate based on questionnaire answers     |
| Generate Multiple      | Click the document name in Document Templates | One document generated per repeating item instance          |
