> For the complete documentation index, see [llms.txt](https://anuvaad.sunbird.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anuvaad.sunbird.org/modules/document-converter.md).

# Document converter

This microservice is intended to generate the final document after translation and digitization. This currently supports `pdf`, `txt`, `xlsx` document generation.

* **API Contract:** [here](/modules/document-converter.md)
* **Code:** [here](/modules/document-converter.md)

## Modules

### Converter Module

#### DocumentConverter

API to create digitized `txt` & `xlsx` files for Translation Flow. RBAC enabled.

**Mandatory parameters:** `record_id`, `user_id`, `file_type`

**Actions:**

* Validating input params as per the policies
* Page data is converted into dataframes
* Writing the data into file and storing them on Samba store

<details>

<summary>DocumentConverter CURL Request</summary>

```bash
curl --location --request POST 'http://localhost:5001//anuvaad-etl/document-converter/v0/document-converter' \
--header 'Content-Type: application/json' \
--data-raw '{ 
  "record_id":"A_OD10GV-IVRCU-1617009019569%7C0-16170090212740283.json", 
  "user_id":"d4e0b570-b72a-44e5-9110-5fdd54370a9d", 
  "file_type":"txt" 
}'
```

</details>

#### DocumentExporter

API to create digitized `txt` & `pdf` files on Document Digitization flow. RBAC enabled.

**Mandatory parameters:** `record_id`, `user_id`, `file_type`

**Actions:**

* Validating input params as per the policies
* Generating the docs using ReportLab
* Writing the data into file and storing them on Samba store

<details>

<summary>DocumentExporter CURL Request</summary>

```bash
curl --location --request POST 'http://localhost:5001//anuvaad-etl/document-converter/v0/document-exporter' \
--header 'Content-Type: application/json' \
--data-raw '{ 
  "record_id":"A_OD10GV-IVRCU-1617009019569%7C0-16170090212740283.json", 
  "user_id":"d4e0b570-b72a-44e5-9110-5fdd54370a9d", 
  "file_type":"txt" 
}'
```

</details>


---

# 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://anuvaad.sunbird.org/modules/document-converter.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.
