DS Server

Document Processing

Topic

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:

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 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 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 shows how to register it, and Errors and Status Codes explains the other answers.

Find the Right Page

If you want toRead
Get an access token and send it with your requestsAuthentication
Convert DOCX, RTF, HTML or PDF into another formatConverting Documents
Create documents from a template and JSON dataMerging Templates
Combine several documents into oneAppending Documents
Replace text placeholders in a documentFind and Replace
List the merge fields, merge blocks and properties of a documentDocument Information
Render the pages of a document as imagesThumbnails
Create PDF or PDF/A with a signature, attachments or permissions, or read the metadata and attachments of a PDFPDF Documents
Read the form fields of a PDF formPDF Form Fields
Create barcode and QR code imagesBarcodes
Find out why a request is refusedErrors and Status Codes

Where to Start

  1. Authentication: create a security profile and request a token.
  2. Converting Documents: 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 reference. A first ASP.NET Core application with the .NET package is built in Getting Started.

Pages in This Section