> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/stackai-tools/document-processing/fill-form-pdf-docx.md).

# Fill Form (PDF/DOCX)

Fill a PDF or DOCX form and return a downloadable completed file. Use it when a workflow has the values needed for an existing form.

## Use this tool

1. Provide the source form in **File**.
2. Enter **Instructions** and provide **Form Data** as field names and values. Use the names in the document.
3. Set **Text Color** and, if needed, **Output Filename**.
4. Run the tool, open **Filled Form URL**, and check the completed fields.

## Behavior and limits

Form Data supports text, numbers, and boolean values for checkboxes. The output extension matches the input format. Check the completed document before distributing it, particularly field placement and selected checkboxes.

## Inputs

| Field                   | Parameter         | Description                                                                                                                                                                            |
| ----------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| File (required)         | `pdf_file`        | URL to a PDF or DOCX form to fill.                                                                                                                                                     |
| Instructions (required) | `instructions`    | Provide context or specific requirements for how the form should be filled. For example: formatting guidelines, language style, or special instructions.                               |
| Form Data               | `form_data`       | JSON object with field names and values to fill in the form. Use the exact field names as they appear in your document. Supports text (strings), checkboxes (true/false), and numbers. |
| Output Filename         | `output_filename` | Custom name for the output file. The extension will match your input file (.pdf or .docx).                                                                                             |
| Text Color (required)   | `text_color`      | Color of the text used to fill in the form fields Default: `"blue"`.                                                                                                                   |

## Outputs

| Field           | Parameter        | Description                     |
| --------------- | ---------------- | ------------------------------- |
| Filled Form URL | `filled_pdf_url` | URL to download the filled form |

## Related guides

* [Parsing, OCR, and Document Structure](https://docs.stackai.com/technical-reference/files-knowledge-and-retrieval/parsing-ocr-and-document-structure.md)


---

# 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://docs.stackai.com/stackai-tools/document-processing/fill-form-pdf-docx.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.
