# AddTXDocumentViewerExtension.AddTXDocumentViewer Method

> Registers the viewer and applies hosting configuration.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 34.5.0
- **Namespace:** `TXTextControl.Web.MVC.DocumentViewer.Hosting`
- **Package:** `TXTextControl.Web.DocumentViewer` (assembly `TXTextControl.Web.MVC.DocumentViewer.dll`, from nuget.org, the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.Web.DocumentViewer.Classic` (assembly `TXTextControl.Web.MVC.DocumentViewer.dll`, from nuget.org)
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.Web.MVC.DocumentViewer.Hosting > AddTXDocumentViewerExtension.AddTXDocumentViewer Method
- **984 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer-hosting/addtxdocumentviewerextension/addtxdocumentviewer-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer-hosting/addtxdocumentviewerextension/addtxdocumentviewer-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer-hosting/addtxdocumentviewerextension/addtxdocumentviewer-method/llms-full.txt

---

### Description

Registers the viewer and applies hosting configuration.

Registers the viewer with default process settings.

### Syntax

#### AddTXDocumentViewer(IServiceCollection, Action<DocumentViewerOptions>)

Call this overload during application startup when the worker process and document viewer hosting options need to be configured explicitly. Call [UseTXDocumentViewerExtension.UseTXDocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer/usetxdocumentviewerextension/usetxdocumentviewer-method/llms-full.txt) after routing has been configured.

```csharp
public static IServiceCollection AddTXDocumentViewer(this IServiceCollection services, Action<DocumentViewerOptions> setupAction);
```

```vbnet
<Extension>
Public Function AddTXDocumentViewer(services As IServiceCollection, setupAction As Action(Of DocumentViewerOptions)) As IServiceCollection
```

| Parameter | Description |
|---|---|
| services | The application's service collection. |
| setupAction | Configuration for the worker processes. |

#### AddTXDocumentViewer(IServiceCollection)

Call this overload during application startup when the default worker process settings are sufficient. Call [UseTXDocumentViewerExtension.UseTXDocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer/usetxdocumentviewerextension/usetxdocumentviewer-method/llms-full.txt) after routing has been configured.

```csharp
public static IServiceCollection AddTXDocumentViewer(this IServiceCollection services);
```

```vbnet
<Extension>
Public Function AddTXDocumentViewer(services As IServiceCollection) As IServiceCollection
```

| Parameter | Description |
|---|---|
| services | The application's service collection. |

### Examples

Example usage.

```csharp
public void ConfigureServices(IServiceCollection services) { services.AddTXDocumentViewer(options => { options.Process.WorkerPool.Count = 4; options.Process.WorkerPool.QueueCapacity = 8; }); }
```

Example usage.

```csharp
public void ConfigureServices(IServiceCollection services) { services.AddTXDocumentViewer(); }
```

### Remarks

Call this overload during application startup when the worker process and document viewer hosting options need to be configured explicitly. Call [UseTXDocumentViewerExtension.UseTXDocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer/usetxdocumentviewerextension/usetxdocumentviewer-method/llms-full.txt) after routing has been configured.

Call this overload during application startup when the default worker process settings are sufficient. Call [UseTXDocumentViewerExtension.UseTXDocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer/usetxdocumentviewerextension/usetxdocumentviewer-method/llms-full.txt) after routing has been configured.

---

## Nearby

- **Previous:** [AddTXDocumentViewerExtension Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer-hosting/addtxdocumentviewerextension/llms-full.txt)
- **Next:** [DiagnosticsOptions Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web-mvc-documentviewer-hosting/diagnosticsoptions/llms-full.txt)
