# aws-textract-helper

> Library for creating forms and tables from Amazon Textract responses

Latest version **1.0.0-beta.5** (published 2020-04-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install aws-textract-helper
pnpm add aws-textract-helper
yarn add aws-textract-helper
bun add aws-textract-helper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-beta.5 |
| Published | 2020-04-04 |
| First published | 2020-03-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Muhi Masri |
| Maintainers | muhimasri |
| Keywords | AWS, Textract, Nodejs |

## Links

- npm: https://www.npmjs.com/package/aws-textract-helper
- Repository: https://github.com/muhimasri/aws-textract-helper
- Homepage: https://github.com/muhimasri/aws-textract-helper#readme
- Issues: https://github.com/muhimasri/aws-textract-helper/issues
- npm.io page: https://npm.io/package/aws-textract-helper

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0-beta.5 (latest) — 2020-04-04
- 1.0.0-beta.1 (beta) — 2020-03-18
- 1.0.0-beta.4 — 2020-03-29
- 1.0.0-beta.3 — 2020-03-29
- 1.0.0-beta.2 — 2020-03-18
- 1.0.0-beta.0 — 2020-03-17

## README

# AWS Textract Helper
This is a JavaScript library that provides an easy to use methods for extracting structured data from Amazon Textract APIs.

## Prerequisites
You need to have a basic knowledge of AWS and Textract APIs. For a quick introduction, please refere to [this article](https://levelup.gitconnected.com/convert-a-form-image-to-an-html-form-using-amazon-textract-and-nodejs-d4d7c1a2b0c5) and [repository example](https://github.com/muhimasri/aws-textract-app) to help you getting started.

## Installation
```
npm i aws-textract-helper
```

## Documentation
| Method        | Description   |
| ------------- | ------------- |
| createForm    | Analyze blocks returned by Textract and creates a key-value object that represents a form in an image |
| createTables  | Analyze blocks returned by Textract and creates an array of tables that represents all the tables in an image |

## Examples

### Create a form
![alt text](https://livecords-dev.s3.us-west-2.amazonaws.com/form-application-small.jpg-1585509821204 "Members Table")
```
const textractHelper = require('aws-textract-helper')
const form = textractHelper.createForm(dataFromTextract)
```
It will analyze all blocks and return a JSON object representing a form
```
{
    "First Name": "Muhi",
    "Last Name": "Masri",
    "Address": "Planet Earth"
}
```
### Create tables
![alt text](https://livecords-dev.s3.us-west-2.amazonaws.com/member-table.PNG-1585509527854 "Members Table")
```
const textractHelper = require('aws-textract-helper')
const tables = textractHelper.createTables(dataFromTextract)
```
It will analyze all blocks and return an array of tables
```
[{
	"1": {
		"1": "Memberld",
		"2": "First Name",
		"3": "Last Name",
		"4": "Address"
	},
	"2": {
		"1": "111",
		"2": "Muhi",
		"3": "Masri",
		"4": "Planet Earth"
	},
	"3": {
		"1": "222",
		"2": "John",
		"3": "Smith",
		"4": "Planet Mars"
	}
}]
```

## Extra options
You can use a trimChar config option to remove unwanted characters in form keys such as a colon or extra spaces
```
const form = textractHelper.createForm(dataFromTextract, { trimChars: [':', ' '] })
```

---
_Source: https://npm.io/package/aws-textract-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
