# Document services

**Category:** Tools

**Version:** 1.0

**Last updated:** April 7, 2026

**Author:** Any2Info

***

### Description

The **Document Services** feature allows users to configure how documents are retrieved and downloaded within the platform.

A document service acts as an abstraction layer between the application and the source of the document. It determines **where the file is retrieved from** and **how it is delivered** to the user.

Document services can be used in the following components:

**Fields:**

* PDF field
* Download field

**Controls:**

* PDF control
* Download control

Each collection contains a **default document service**, which runs on the Any2Info webserver. When this service is used, the document download is executed directly from the Any2Info server.

For advanced use cases, it is possible to run a **standalone document service** on a separate server. To configure this setup, please contact:\
<support@any2info.com>

The default document service can be extended with multiple plugins, allowing different document sources and behaviors.

***

### Configuration Options

Document services are configured via plugins. Each plugin type has its own configuration parameters.

#### SQL Server

| Setting         | Required | Description                                                            |
| --------------- | -------- | ---------------------------------------------------------------------- |
| Server name     | Yes      | Name of the SQL Server (including instance if applicable).             |
| Database        | Yes      | Name of the database.                                                  |
| Username        | Yes      | SQL user name.                                                         |
| Password        | Yes      | SQL user password.                                                     |
| Table           | No       | Table containing the document. Not required when using a custom query. |
| IdHeader        | Yes      | Column used as unique identifier.                                      |
| ExtensionHeader | Yes      | Column containing the file extension.                                  |
| ByteHeader      | Yes      | Column containing the file data (varbinary).                           |
| NameHeader      | Yes      | Column containing the file name.                                       |
| CustomQuery     | No       | Custom query when data is not in a single table.                       |

> A unique identifier is always required when using this plugin.

***

#### ODBC

| Setting          | Required | Description                           |
| ---------------- | -------- | ------------------------------------- |
| Connectionstring | Yes      | ODBC connection string.               |
| Table            | No       | Table containing the document.        |
| IdHeader         | Yes      | Column used as unique identifier.     |
| ExtensionHeader  | Yes      | Column containing the file extension. |
| ByteHeader       | Yes      | Column containing the file data.      |
| NameHeader       | Yes      | Column containing the file name.      |
| CustomQuery      | No       | Custom query for complex scenarios.   |

> A unique identifier is always required when using this plugin.

***

#### Form

| Setting      | Required | Description                                                   |
| ------------ | -------- | ------------------------------------------------------------- |
| ConvertToPDF | No       | Determines if the document is downloaded as PDF or Word file. |

> The identifier must be the **Form ID**.

***

#### File System

| Setting             | Required | Description                 |
| ------------------- | -------- | --------------------------- |
| UseUserImpersonator | No       | Enables user impersonation. |
| Username            | No       | Username for impersonation. |
| Password            | No       | Password for impersonation. |
| Domain              | No       | Domain for impersonation.   |

If impersonation is not used, the identity of the IIS Application Pool (`Any2InfoAppsService`) is used.

This plugin supports downloading files from:

* Local server file system
* Network shares accessible by the server

***

#### Dataflow

| Setting                  | Required | Description                                    |
| ------------------------ | -------- | ---------------------------------------------- |
| DatahubId                | Yes      | The DataHub to use.                            |
| IdParameter              | Yes      | Parameter name containing the file identifier. |
| DataflowEvent            | Yes      | EventReceived trigger name.                    |
| ExtensionOutputParameter | Yes      | Output parameter for file extension.           |
| NameOutputParameter      | Yes      | Output parameter for file name.                |
| ByteOutputParameter      | Yes      | Output parameter for file content.             |

This is the most versatile plugin and allows integration with:

* SharePoint
* REST APIs
* External systems via DataHub

***

### Input / Output

| Direction | Type       | Description                                         |
| --------- | ---------- | --------------------------------------------------- |
| Input     | Identifier | Unique identifier used to retrieve the file.        |
| Output    | File       | File stream including name, extension, and content. |

> The required identifier depends on the selected plugin.

***

### Usage

#### Configuration

Document services can be configured via:

**Tools → DocumentServices**

Steps to configure a plugin:

1. Select the ellipsis (`...`) next to the default service
2. Choose **New plugin**
3. Provide a name (e.g. *Download instruction (file share)*)
4. Save the plugin
5. Locate the plugin in the tree structure
6. Select the ellipsis (`...`) on the plugin
7. Choose **Configure**
8. Select the plugin type
9. Configure the required parameters

***

#### Assigning a Document Service

After configuration:

* Select the document service in the **Document service** property of a field or control
* Provide a **File identifier**:
  * Static value
  * Or mapped dynamically

***

### Tips & Best Practices

* Always ensure a **unique identifier** is available for the selected plugin
* When using a **PDF field or control**, ensure the file is a valid PDF
  * Otherwise, no pages will be displayed
* Use the **Dataflow plugin** for maximum flexibility and external integrations
* Use **custom queries** when document metadata is spread across multiple tables

***

### Errors & Troubleshooting

| Error             | Meaning                                 | Solution                                         |
| ----------------- | --------------------------------------- | ------------------------------------------------ |
| File not found    | Identifier does not match any record    | Verify identifier value and mapping              |
| Invalid PDF       | File is not a valid PDF                 | Ensure correct file type is returned             |
| Connection failed | Database or ODBC connection issue       | Verify connection settings and credentials       |
| Access denied     | File system permissions issue           | Check impersonation or application pool identity |
| Dataflow failure  | Dataflow did not return expected output | Verify event configuration and output parameters |

***

### Example Use Cases

* Displaying employee work instructions based on production data
* Downloading invoices or offers
* Retrieving documents from SharePoint or external APIs

***

### Changelog

| Version | Date          | Change                               |
| ------- | ------------- | ------------------------------------ |
| 1.0     | April 7, 2026 | Initial documentation version added. |
