Skip to content

AnalyzeDocument

Source: src/AWS/Textract/AnalyzeDocument.ts

Runtime binding for textract:AnalyzeDocument — synchronous analysis of relationships in a document: forms (key-value pairs), tables, layout, signatures, and natural-language queries. Pass the document as raw bytes or as an S3 object reference; the caller needs s3:GetObject on the bucket for S3 input (bind AWS.S3.GetObject(bucket) alongside).

// init
const analyzeDocument = yield* AWS.Textract.AnalyzeDocument();
// runtime
const result = yield* analyzeDocument({
Document: { Bytes: documentBytes },
FeatureTypes: ["FORMS", "TABLES"],
});
const tables = (result.Blocks ?? []).filter((b) => b.BlockType === "TABLE");