Visualizing Results

When debugging it’s usually helpful to be able to see what went wrong. Textractor offers simple API to see your output that can help a lot when developing heuristics.


To begin, install the amazon-textract-textractor package using pip.

pip install amazon-textract-textractor

There are various sets of dependencies available to tailor your installation to your use case. The base package will have sensible default, but you may want to install the PDF extra dependencies if your workflow uses PDFs with pip install amazon-textract-textractor[pdf]. You can read more on extra dependencies in the documentation

Calling Textract

import os
from PIL import Image
from textractor import Textractor
from import TextractFeatures

extractor = Textractor(profile_name="default")
document = extractor.analyze_document("../../../tests/fixtures/form.png"),
    features=[TextractFeatures.FORMS, TextractFeatures.TABLES],

Let’s look at the asset.

This document holds the following data:
Pages - 1
Words - 494
Lines - 129
Key-values - 20
Checkboxes - 29
Tables - 1
Identity Documents - 0
Expense Documents - 0

Visualizing Tables

Tables can be visualized as well (here) in purple.



Textractor packs visualization utilities that help you understand the Textract output to implement better heuristics.