# Document Processing

> Convert, merge, append and analyze documents over HTTP with the DocumentProcessing Web API: access tokens, Base64 JSON bodies, curl and .NET, PDF and barcodes.

- **Product:** DS Server
- **Section:** Documentation
- **Kind:** Topic
- **Path:** DS Server > Document Processing
- **1308 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/document-processing/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/document-processing/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/document-processing/llms-full.txt

---

The DocumentProcessing Web API is the part of DS Server that works on documents without a user interface. A backend in any language sends it a document or a template over HTTP and gets a converted, merged, combined or analyzed document back: PDF from DOCX, invoices from a template and JSON data, page thumbnails, barcodes or the form fields of a PDF. Each task has its own guide below, with a curl request and the same call in C#.

### How a Request Looks

Every endpoint sits below `/documentprocessing/` of your DS Server's *service URL*. The service URL is `http://localhost:5000` when DS Server runs on its own on the default port, and it contains the path of the IIS site behind IIS, such as `https://yourdomain.com/DocumentServices`. A request to convert a document looks like this:

```bash
curl --request POST "http://localhost:5000/documentprocessing/document/convert?returnFormat=PDF" \
  --header "Authorization: Bearer <access_token>" \
  --header "Content-Type: application/json" \
  --data-binary @document.json
```

The parts of every request:

- **The access token** in an `Authorization: Bearer` header. A backend requests it from DS Server with the client ID and secret of a security profile, as [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt) shows.
- **Documents as Base64.** The body is JSON with the content type `application/json`. A document is a Base64 string: a single document is the body itself, a JSON string, as for convert, info, thumbnails and the PDF readers, and endpoints that take more, such as merge, append and pdf/create, take a JSON object with properties such as `template`, `documents` or `documentData`.
- **Options as query parameters**, such as `returnFormat=PDF` or `append=false`.
- **Results as Base64.** A created document comes back as a Base64 string in a JSON string, and several documents or images as a JSON array of such strings. The endpoints that read documents, such as info or pdf/acroforms/fields, return JSON with the information.

The .NET package `TXTextControl.DocumentServices.DocumentProcessing` wraps the same requests in the `DocumentProcessing` class, which takes and returns byte arrays and requests the access token itself. [ASP.NET Core](https://docs.textcontrol.com/ds-server/client-libraries/aspnet-core/#documentprocessing) lists its methods.

The server must be licensed: until it is registered, every endpoint answers `400` with the message "DS Server is not registered.". [Licensing](https://docs.textcontrol.com/ds-server/administration/licensing/llms-full.txt) shows how to register it, and [Errors and Status Codes](https://docs.textcontrol.com/ds-server/document-processing/errors/llms-full.txt) explains the other answers.

### Find the Right Page

| If you want to | Read |
|---|---|
| Get an access token and send it with your requests | [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt) |
| Convert DOCX, RTF, HTML or PDF into another format | [Converting Documents](https://docs.textcontrol.com/ds-server/document-processing/converting/llms-full.txt) |
| Create documents from a template and JSON data | [Merging Templates](https://docs.textcontrol.com/ds-server/document-processing/mail-merge/llms-full.txt) |
| Combine several documents into one | [Appending Documents](https://docs.textcontrol.com/ds-server/document-processing/appending/llms-full.txt) |
| Replace text placeholders in a document | [Find and Replace](https://docs.textcontrol.com/ds-server/document-processing/find-replace/llms-full.txt) |
| List the merge fields, merge blocks and properties of a document | [Document Information](https://docs.textcontrol.com/ds-server/document-processing/document-info/llms-full.txt) |
| Render the pages of a document as images | [Thumbnails](https://docs.textcontrol.com/ds-server/document-processing/thumbnails/llms-full.txt) |
| Create PDF or PDF/A with a signature, attachments or permissions, or read the metadata and attachments of a PDF | [PDF Documents](https://docs.textcontrol.com/ds-server/document-processing/pdf/llms-full.txt) |
| Read the form fields of a PDF form | [PDF Form Fields](https://docs.textcontrol.com/ds-server/document-processing/pdf-forms/llms-full.txt) |
| Create barcode and QR code images | [Barcodes](https://docs.textcontrol.com/ds-server/document-processing/barcodes/llms-full.txt) |
| Find out why a request is refused | [Errors and Status Codes](https://docs.textcontrol.com/ds-server/document-processing/errors/llms-full.txt) |

### Where to Start

1. [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt): create a security profile and request a token.
2. [Converting Documents](https://docs.textcontrol.com/ds-server/document-processing/converting/llms-full.txt): send a first request and decode the result.
3. The page of the task you need, from the table above.

The endpoints, with every parameter and response, are listed in the [DocumentProcessing](https://docs.textcontrol.com/ds-server/reference/web-api/documentprocessing/llms-full.txt) reference. A first ASP.NET Core application with the .NET package is built in [Getting Started](https://docs.textcontrol.com/ds-server/getting-started/document-processing/aspnet-core/llms-full.txt).

### Pages in This Section

- [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt): request an access token, send it and renew it.
- [Converting Documents](https://docs.textcontrol.com/ds-server/document-processing/converting/llms-full.txt): convert a document to PDF, DOCX, HTML and other formats.
- [Merging Templates](https://docs.textcontrol.com/ds-server/document-processing/mail-merge/llms-full.txt): merge a template with JSON data into one or many documents.
- [Appending Documents](https://docs.textcontrol.com/ds-server/document-processing/appending/llms-full.txt): combine documents with a divider between them.
- [Find and Replace](https://docs.textcontrol.com/ds-server/document-processing/find-replace/llms-full.txt): replace text in a document.
- [Document Information](https://docs.textcontrol.com/ds-server/document-processing/document-info/llms-full.txt): read the properties, merge fields and merge blocks of a document.
- [Thumbnails](https://docs.textcontrol.com/ds-server/document-processing/thumbnails/llms-full.txt): create images of document pages.
- [PDF Documents](https://docs.textcontrol.com/ds-server/document-processing/pdf/llms-full.txt): create and read PDF documents.
- [PDF Form Fields](https://docs.textcontrol.com/ds-server/document-processing/pdf-forms/llms-full.txt): read the AcroForm fields of a PDF.
- [Barcodes](https://docs.textcontrol.com/ds-server/document-processing/barcodes/llms-full.txt): create barcode images and check barcode text.
- [Errors and Status Codes](https://docs.textcontrol.com/ds-server/document-processing/errors/llms-full.txt): the answers of the Web API and what they mean.

---

## In This Section

- [Appending Documents](https://docs.textcontrol.com/ds-server/document-processing/appending/llms-full.txt): Put a cover letter in front of an invoice or join reports into one PDF with the append endpoint: AppendDocument, section dividers and document properties.
- [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt): Request an OAuth access token at /oauth/token with the client credentials or authorization code grant, send it as a Bearer header and renew it in curl or .NET.
- [Barcodes](https://docs.textcontrol.com/ds-server/document-processing/barcodes/llms-full.txt): Generate QR code, Code 128 or Data Matrix images in curl or .NET with barcodes/create: size, colors and text, plus length and validity checks of the text first.
- [Converting Documents](https://docs.textcontrol.com/ds-server/document-processing/converting/llms-full.txt): Convert DOCX, RTF, HTML and PDF to PDF, PDF/A, DOCX, DOC, RTF, HTML, TX or plain text with the convert endpoint and flatten form fields, from curl or .NET.
- [Document Information](https://docs.textcontrol.com/ds-server/document-processing/document-info/llms-full.txt): Check a template before a merge: read its merge fields, nested merge blocks and properties with the info endpoint or DocumentInfo, and list server printers.
- [Errors and Status Codes](https://docs.textcontrol.com/ds-server/document-processing/errors/llms-full.txt): Handle 400, 401, 404, 405 and 415 answers of the DocumentProcessing Web API: not registered, validation and token errors, and ServiceRequestException in .NET.
- [Find and Replace](https://docs.textcontrol.com/ds-server/document-processing/find-replace/llms-full.txt): Replace text placeholders such as %%CustomerName%% in DOCX, DOC or RTF documents with the findandreplace endpoint and FindAndReplaceBody instead of a merge.
- [Merging Templates](https://docs.textcontrol.com/ds-server/document-processing/mail-merge/llms-full.txt): Merge DOCX templates with JSON data into invoices and letters with the merge endpoint: merge fields, merge blocks, one document per record and MergeSettings.
- [PDF Form Fields](https://docs.textcontrol.com/ds-server/document-processing/pdf-forms/llms-full.txt): Extract the values of text boxes, check boxes and combo boxes from the AcroForm fields of a PDF form with pdf/acroforms/fields or GetFields, and flatten fields.
- [PDF Documents](https://docs.textcontrol.com/ds-server/document-processing/pdf/llms-full.txt): Create PDF and PDF/A-3b with pdf/create: properties, passwords, access permissions, digital signatures and attachments; read PDF metadata and embedded files.
- [Thumbnails](https://docs.textcontrol.com/ds-server/document-processing/thumbnails/llms-full.txt): Create page previews of DOCX and PDF files as PNG, JPG or SVG images with the thumbnails endpoint in curl or .NET: zoom factor, page range and SVG on Linux.

---

## Nearby

- **Previous:** [React](https://docs.textcontrol.com/ds-server/client-libraries/react/llms-full.txt)
- **Next:** [Authentication](https://docs.textcontrol.com/ds-server/document-processing/authentication/llms-full.txt)
