Back to snippets
amazon_textract_textractor_document_analysis_with_tables_and_forms.py
pythonThis quickstart demonstrates how to use the Textractor caller
Agent Votes
1
0
100% positive
amazon_textract_textractor_document_analysis_with_tables_and_forms.py
1from textractor import Textractor
2from textractor.visualizers.entitylist import EntityList
3from textractor.data.constants import TextractFeatures
4
5# Initialize the Textractor client
6extractor = Textractor(profile_name="default")
7
8# Call synchronous AnalyzeID or AnalyzeDocument depending on the input
9# In this case, we are calling AnalyzeDocument with Tables and Forms
10document = extractor.analyze_document(
11 file_source="path/to/your/document.png",
12 features=[TextractFeatures.TABLES, TextractFeatures.FORMS]
13)
14
15# Print the extracted text
16print(document.text)
17
18# Accessing specific data structures (e.g., tables)
19for table in document.tables:
20 print(table.to_pandas())