> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/quick-start/template-building/customize-template-settings-document-generation.md).

# Customize Template Settings: Document Generation

Configure page layout, file naming, and file save behavior for a quote Document Template.

Use this tutorial when you want one Document Template to generate polished quotes with consistent layout and file handling.

## Reviewing expected results

After setup, one generated quote gives you:

* A PDF with a consistent file name, such as `Quote-Acme Corporation-2026-04-09.pdf`
* A Salesforce File linked to the Opportunity
* Page spacing that leaves room for company letterhead

Use this configuration for quote, invoice, and renewal Document Templates that need predictable output.

## Choosing Document Template settings

Use Document Template settings when you need predictable output from one Document Template.

**Best for:**

* Quote Document Templates with fixed page layout and file naming
* Invoice Document Templates that should save as Salesforce Files
* Renewal or contract Document Templates with consistent output formatting

Use another feature when the problem is different:

* Use [How to Show or Hide Content Automatically](https://help.sdocs.com/quick-start/template-building/conditional-logic-tutorial.md).
* Use [Adding Tables (Like Products or Contacts) to Your Document](https://help.sdocs.com/quick-start/template-building/adding-tables-like-products-or-contacts-to-your-document.md).
* Use [How to Format Text, Dates, and Currency](https://help.sdocs.com/quick-start/template-building/how-to-format-text-dates-and-currency.md).

## Configure settings for a quote Document Template

### Configure These Settings

* Custom page margins for letterhead
* An automatic output file name
* Automatic file save behavior

**Estimated time:** 15 minutes

### Meet Prerequisites

Before starting, make sure you have:

* An existing S-Docs Document Template
* The Document Template's **Related To Type** set to `Opportunity`
* Permission to edit S-Docs Document Templates
* At least one Opportunity with an Account and line items for testing
* Basic familiarity with Merge Field syntax

If you do not have a starter Document Template, create one first.

{% stepper %}
{% step %}

### Open the Document Template Editor

1. Navigate to **S-Docs Templates**.
2. Open your quote Document Template.
3. Click **Edit Template**.
4. Confirm the editor shows tabs such as **Page Settings**, **Document Options**, and **Email Settings**.

You are now in the screen where all Document Template settings appear.
{% endstep %}

{% step %}

### Set Page Margins for Letterhead

Use custom margins when your company header is already printed or built into the design.

1. Open **Page Settings**.
2. Set **Page Layout** to `Custom`.
3. Enter these values:
   * **Page Width:** `8.5`
   * **Page Height:** `11`
   * **Top Margin:** `2`
   * **Bottom Margin:** `1`
   * **Left Margin:** `0.75`
   * **Right Margin:** `0.75`
   * **Unit:** `inches`

This leaves extra room at the top and keeps body content readable.
{% endstep %}

{% step %}

### Set the Output File Name

This controls the file name you see in Salesforce and email attachments.

1. Open **Document Options**.
2. Find **Attachment & File Name Options**.
3. In **Output File Format**, enter:

{% code title="Output file format" %}

```
Quote-{!Opportunity.Account.Name}-{!TODAY()}.pdf
```

{% endcode %}

A generated file now follows one consistent pattern.

Example output: `Quote-Acme Corporation-2026-04-09.pdf`

{% hint style="info" %}
Use single-brace Merge Fields like `{!Opportunity.Name}` in settings tabs. Use double-brace Merge Fields like `{{!Opportunity.Name}}` in the Document Template body.
{% endhint %}
{% endstep %}

{% step %}

### Save the Generated Document as a Salesforce File

This keeps each generated quote attached to the source record.

1. Stay in **Document Options**.
2. Under **Attachment & File Options**, enable **Create Salesforce File and link to record**.
3. Leave **Delete related Salesforce Attachment/File upon S-Doc deletion** enabled.

Each generated quote now appears in the record's **Files** related list.
{% endstep %}
{% endstepper %}

Save the Document Template. Then generate one test document.

Verify these results:

* The file name matches your expected pattern.
* The quote appears in the **Files** related list.
* The top margin leaves room for letterhead.

## Applying guardrails and limits

### Follow Merge Field Rules

* **Use** single braces in settings tabs.
* If you mix syntax or casing, values can print as raw text or stay blank.

### Configure File Behavior

* **Enable** Salesforce Files in your org if your team saves generated documents there.
* **Expect** the generated file to link back to the source record when file creation is enabled.

### Follow Testing Rules

* **Test** with an Opportunity that already has real account data.
* **Generate** a fresh document after each settings change.
* **Verify** the file name, Files related list, and page spacing every time.
* If you skip testing, layout and file issues can surface after you generate live documents.


---

# 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://help.sdocs.com/quick-start/template-building/customize-template-settings-document-generation.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.
