Sample code for 30+ languages & platforms
DataFlex

AWS Textract Detect Document Text

See more AWS Misc Examples

Detects text in the input document. Amazon Textract can detect lines of text and the words that make up a line of text. The input document must be in one of the following image formats: JPEG, PNG, PDF, or TIFF.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoRest
    Boolean iBTls
    Integer iPort
    Boolean iBAutoReconnect
    Variant vAuthAws
    Handle hoAuthAws
    Handle hoJson
    Handle hoBdPng
    Variant vSbRequestBody
    Handle hoSbRequestBody
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Integer iRespStatusCode
    Handle hoJResp
    String sBlockType
    String sHeight
    String sLeft
    String sTop
    String sWidth
    String sId
    String sConfidence
    String sText
    String sTextType
    Integer j
    Integer iCount_j
    String X
    String Y
    String sV_Type
    Integer k
    Integer iCount_k
    String sStrVal
    String sDetectDocumentTextModelVersion
    Integer iPages
    Integer i
    Integer iCount_i
    String sTemp1

    Move False To iSuccess

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    Move True To iBTls
    Move 443 To iPort
    Move True To iBAutoReconnect
    Get ComConnect Of hoRest "textract.us-west-2.amazonaws.com" iPort iBTls iBAutoReconnect To iSuccess

    // Provide AWS credentials for the REST call.
    Get Create (RefClass(cComChilkatAuthAws)) To hoAuthAws
    If (Not(IsComObjectCreated(hoAuthAws))) Begin
        Send CreateComObject of hoAuthAws
    End
    Set ComAccessKey Of hoAuthAws To "AWS_ACCESS_KEY"
    Set ComSecretKey Of hoAuthAws To "AWS_SECRET_KEY"
    // the region should match our URL above..
    Set ComRegion Of hoAuthAws To "us-west-2"
    Set ComServiceName Of hoAuthAws To "textract"

    Get pvComObject of hoAuthAws to vAuthAws
    Get ComSetAuthAws Of hoRest vAuthAws To iSuccess

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End

    // The JSON can contain either the actual bytes of the JPG, PDF, PNG, etc.
    // or a reference to the S3 object.
    // 
    // {
    //    "Document": { 
    //       "Bytes": blob,
    //       "S3Object": { 
    //          "Bucket": "string",
    //          "Name": "string",
    //          "Version": "string"
    //       }
    //    }
    // }

    // In this example we'll send the Bytes.  The S3Object is omitted.

    Get Create (RefClass(cComChilkatBinData)) To hoBdPng
    If (Not(IsComObjectCreated(hoBdPng))) Begin
        Send CreateComObject of hoBdPng
    End
    Get ComLoadFile Of hoBdPng "qa_data/png/image_with_text.png" To iSuccess
    If (iSuccess = False) Begin
        Showln "Failed to load PNG file."
        Procedure_Return
    End

    Get ComGetEncoded Of hoBdPng "base64" To sTemp1
    Get ComUpdateString Of hoJson "Document.Bytes" sTemp1 To iSuccess

    Get ComAddHeader Of hoRest "Content-Type" "application/x-amz-json-1.1" To iSuccess
    Get ComAddHeader Of hoRest "X-Amz-Target" "Textract.DetectDocumentText" To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbRequestBody
    If (Not(IsComObjectCreated(hoSbRequestBody))) Begin
        Send CreateComObject of hoSbRequestBody
    End
    Get pvComObject of hoSbRequestBody to vSbRequestBody
    Get ComEmitSb Of hoJson vSbRequestBody To iSuccess
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbRequestBody to vSbRequestBody
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComFullRequestSb Of hoRest "POST" "/" vSbRequestBody vSbResponseBody To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComResponseStatusCode Of hoRest To iRespStatusCode
    Showln "response status code = " iRespStatusCode

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Set ComEmitCompact Of hoJResp To False
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess

    If (iRespStatusCode >= 400) Begin
        Showln "Response Status Code = " iRespStatusCode
        Showln "Response Header:"
        Get ComResponseHeader Of hoRest To sTemp1
        Showln sTemp1
        Showln "Response Body:"
        Get ComEmit Of hoJResp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    // Sample response body is shown below.

    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    Get ComStringOf Of hoJResp "DetectDocumentTextModelVersion" To sDetectDocumentTextModelVersion
    Get ComIntOf Of hoJResp "DocumentMetadata.Pages" To iPages
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "Blocks" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "Blocks[i].BlockType" To sBlockType
        Get ComStringOf Of hoJResp "Blocks[i].Geometry.BoundingBox.Height" To sHeight
        Get ComStringOf Of hoJResp "Blocks[i].Geometry.BoundingBox.Left" To sLeft
        Get ComStringOf Of hoJResp "Blocks[i].Geometry.BoundingBox.Top" To sTop
        Get ComStringOf Of hoJResp "Blocks[i].Geometry.BoundingBox.Width" To sWidth
        Get ComStringOf Of hoJResp "Blocks[i].Id" To sId
        Get ComStringOf Of hoJResp "Blocks[i].Confidence" To sConfidence
        Get ComStringOf Of hoJResp "Blocks[i].Text" To sText
        Get ComStringOf Of hoJResp "Blocks[i].TextType" To sTextType
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "Blocks[i].Geometry.Polygon" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "Blocks[i].Geometry.Polygon[j].X" To X
            Get ComStringOf Of hoJResp "Blocks[i].Geometry.Polygon[j].Y" To Y
            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "Blocks[i].Relationships" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "Blocks[i].Relationships[j].Type" To sV_Type
            Move 0 To k
            Get ComSizeOfArray Of hoJResp "Blocks[i].Relationships[j].Ids" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "Blocks[i].Relationships[j].Ids[k]" To sStrVal
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop

    // {
    //   "Blocks": [
    //     {
    //       "BlockType": "PAGE",
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 1.0,
    //           "Left": 0.0,
    //           "Top": 0.0,
    //           "Width": 1.0
    //         },
    //         "Polygon": [
    //           {
    //             "X": 7.334237466238847E-7,
    //             "Y": 0.0
    //           },
    //           {
    //             "X": 1.0,
    //             "Y": 2.065305579890264E-6
    //           },
    //           {
    //             "X": 1.0,
    //             "Y": 1.0
    //           },
    //           {
    //             "X": 0.0,
    //             "Y": 1.0
    //           }
    //         ]
    //       },
    //       "Id": "9d01c4e1-c7ee-46d3-a020-b5d691551542",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "5d230339-1492-4715-b643-3c1c092b9601",
    //             "06eb9de7-c1b2-4de4-83d4-bf14c683bbbc",
    //             "e3708093-ddce-4ece-b51b-36e75ee0650a",
    //             "0b75416b-4c5a-47ee-af5f-38e86196d09d",
    //             "f8e53727-d359-40a1-9c7a-17212be5b62f"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ]
    //     },
    //     {
    //       "BlockType": "LINE",
    //       "Confidence": 99.96929168701172,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.1283034384250641,
    //           "Left": 0.02562711574137211,
    //           "Top": 0.04522315785288811,
    //           "Width": 0.7353771924972534
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.025710511952638626,
    //             "Y": 0.04522315785288811
    //           },
    //           {
    //             "X": 0.7610043287277222,
    //             "Y": 0.04609351605176926
    //           },
    //           {
    //             "X": 0.7609506249427795,
    //             "Y": 0.1735266000032425
    //           },
    //           {
    //             "X": 0.02562711574137211,
    //             "Y": 0.17263372242450714
    //           }
    //         ]
    //       },
    //       "Id": "5d230339-1492-4715-b643-3c1c092b9601",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "d10275a1-6a07-4df3-836e-b8418c7302e1",
    //             "f9394a51-8386-4245-b8f6-a4b8889b16be",
    //             "4a422774-0db5-47b1-9d86-486ee4df7bc9",
    //             "5018930a-0cb5-4df2-a782-ccb40b98692e",
    //             "5decb4b9-fa44-4b74-a410-d753ca9da87e"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ],
    //       "Text": "It was the best of"
    //     },
    //     {
    //       "BlockType": "LINE",
    //       "Confidence": 99.95220184326172,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.15143845975399017,
    //           "Left": 0.02354392223060131,
    //           "Top": 0.23623499274253845,
    //           "Width": 0.9416812658309937
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.02364235743880272,
    //             "Y": 0.23623499274253845
    //           },
    //           {
    //             "X": 0.9652252197265625,
    //             "Y": 0.23739269375801086
    //           },
    //           {
    //             "X": 0.9651715755462646,
    //             "Y": 0.3876734673976898
    //           },
    //           {
    //             "X": 0.02354392223060131,
    //             "Y": 0.38648173213005066
    //           }
    //         ]
    //       },
    //       "Id": "06eb9de7-c1b2-4de4-83d4-bf14c683bbbc",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "df38a25e-1237-4837-9c73-2628cf2a60d6",
    //             "4006856d-989a-413a-a19d-ba58464056c7",
    //             "0cefb90d-9771-4a62-b47b-f4653f5a5fdc",
    //             "b090e2a0-59cb-483a-8489-eb7367c3ec42",
    //             "584e024d-cdb8-4991-964a-a6c00a219b4d"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ],
    //       "Text": "times, it was the worst"
    //     },
    //     {
    //       "BlockType": "LINE",
    //       "Confidence": 99.97298431396484,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.1645825207233429,
    //           "Left": 0.023708077147603035,
    //           "Top": 0.42446625232696533,
    //           "Width": 0.958830714225769
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.023815063759684563,
    //             "Y": 0.42446625232696533
    //           },
    //           {
    //             "X": 0.9825388193130493,
    //             "Y": 0.42568835616111755
    //           },
    //           {
    //             "X": 0.9824814200401306,
    //             "Y": 0.5890488028526306
    //           },
    //           {
    //             "X": 0.023708077147603035,
    //             "Y": 0.5877890586853027
    //           }
    //         ]
    //       },
    //       "Id": "e3708093-ddce-4ece-b51b-36e75ee0650a",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "9e7fcad8-5fac-497e-941c-6af065273c4f",
    //             "06fa7250-a384-44b1-a821-f4961437dab8",
    //             "a5856e1f-1c35-4fd8-9d5c-ec112ce446da",
    //             "5d92695a-2ef5-4175-8483-955bdd21c8c5",
    //             "145e3940-2b15-4b0f-a1ef-c1eec67bfd34",
    //             "979e61b4-b915-4001-8761-e417fb5bcc88"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ],
    //       "Text": "of times, it was the age"
    //     },
    //     {
    //       "BlockType": "LINE",
    //       "Confidence": 99.92354583740234,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.15201467275619507,
    //           "Left": 0.02298363670706749,
    //           "Top": 0.6132552623748779,
    //           "Width": 0.8867681622505188
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.02308245748281479,
    //             "Y": 0.6132552623748779
    //           },
    //           {
    //             "X": 0.909751832485199,
    //             "Y": 0.6144257187843323
    //           },
    //           {
    //             "X": 0.9096953868865967,
    //             "Y": 0.765269935131073
    //           },
    //           {
    //             "X": 0.02298363670706749,
    //             "Y": 0.7640674114227295
    //           }
    //         ]
    //       },
    //       "Id": "0b75416b-4c5a-47ee-af5f-38e86196d09d",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "477b9395-e813-4f47-8f6c-bbc6fd2a1b1d",
    //             "cb715516-6798-4db7-922e-aaa05c999497",
    //             "ff4bbb55-0ab1-4c91-a910-c44da34f3702",
    //             "8eae93f4-70a2-4723-b532-e52dfdde18fc",
    //             "7a25756d-68e2-45ec-bef4-f919294fecb3"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ],
    //       "Text": "of wisdom, it was the"
    //     },
    //     {
    //       "BlockType": "LINE",
    //       "Confidence": 99.92982482910156,
    //       "Geometry": {
    // 
    //         "BoundingBox": {
    //           "Height": 0.1690569967031479,
    //           "Left": 0.02215408906340599,
    //           "Top": 0.7996805906295776,
    //           "Width": 0.7357001900672913
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.022264225408434868,
    //             "Y": 0.7996805906295776
    //           },
    //           {
    //             "X": 0.7578542828559875,
    //             "Y": 0.8006845116615295
    //           },
    //           {
    //             "X": 0.7577832937240601,
    //             "Y": 0.9687376022338867
    //           },
    //           {
    //             "X": 0.02215408906340599,
    //             "Y": 0.9677039980888367
    //           }
    //         ]
    //       },
    //       "Id": "f8e53727-d359-40a1-9c7a-17212be5b62f",
    //       "Relationships": [
    //         {
    //           "Ids": [
    //             "5763091d-4807-44b0-94d6-1f6fba7c66ad",
    //             "f08b6956-7c97-4877-83e2-f495b3983963",
    //             "275f5f9f-fcd6-4447-8242-c6e777fc762a"
    //           ],
    //           "Type": "CHILD"
    //         }
    //       ],
    //       "Text": "age of foolishness"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.95569610595703,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12361754477024078,
    //           "Left": 0.02562711574137211,
    //           "Top": 0.049105118960142136,
    //           "Width": 0.07332543283700943
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.025707971304655075,
    //             "Y": 0.049105118960142136
    //           },
    //           {
    //             "X": 0.09895254671573639,
    //             "Y": 0.04919188469648361
    //           },
    //           {
    //             "X": 0.09887456148862839,
    //             "Y": 0.17272266745567322
    //           },
    //           {
    //             "X": 0.02562711574137211,
    //             "Y": 0.17263372242450714
    //           }
    //         ]
    //       },
    //       "Id": "d10275a1-6a07-4df3-836e-b8418c7302e1",
    //       "Text": "It",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.91895294189453,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.07870253175497055,
    //           "Left": 0.12013984471559525,
    //           "Top": 0.09188469499349594,
    //           "Width": 0.15315164625644684
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.1201888844370842,
    //             "Y": 0.09188469499349594
    //           },
    //           {
    //             "X": 0.2732914984226227,
    //             "Y": 0.09206762909889221
    //           },
    //           {
    //             "X": 0.27324625849723816,
    //             "Y": 0.1705872267484665
    //           },
    //           {
    //             "X": 0.12013984471559525,
    //             "Y": 0.17040139436721802
    //           }
    //         ]
    //       },
    //       "Id": "f9394a51-8386-4245-b8f6-a4b8889b16be",
    //       "Text": "was",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9923095703125,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12304235994815826,
    //           "Left": 0.30181974172592163,
    //           "Top": 0.048208922147750854,
    //           "Width": 0.13491466641426086
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.30188941955566406,
    //             "Y": 0.048208922147750854
    //           },
    //           {
    //             "X": 0.4367344081401825,
    //             "Y": 0.04836862161755562
    //           },
    //           {
    //             "X": 0.4366699755191803,
    //             "Y": 0.17125128209590912
    //           },
    //           {
    //             "X": 0.30181974172592163,
    //             "Y": 0.1710876077413559
    //           }
    //         ]
    //       },
    //       "Id": "4a422774-0db5-47b1-9d86-486ee4df7bc9",
    //       "Text": "the",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9902114868164,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12650197744369507,
    //           "Left": 0.4637022018432617,
    //           "Top": 0.04641735553741455,
    //           "Width": 0.17412298917770386
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.46376731991767883,
    //             "Y": 0.04641735553741455
    //           },
    //           {
    //             "X": 0.6378251910209656,
    //             "Y": 0.046623412519693375
    //           },
    //           {
    //             "X": 0.6377670168876648,
    //             "Y": 0.17291933298110962
    //           },
    //           {
    //             "X": 0.4637022018432617,
    //             "Y": 0.17270798981189728
    //           }
    //         ]
    //       },
    //       "Id": "5018930a-0cb5-4df2-a782-ccb40b98692e",
    //       "Text": "best",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98930358886719,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12482605874538422,
    //           "Left": 0.6641513109207153,
    //           "Top": 0.04597894102334976,
    //           "Width": 0.09685297310352325
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.6642076969146729,
    //             "Y": 0.04597894102334976
    //           },
    //           {
    //             "X": 0.7610043287277222,
    //             "Y": 0.04609351605176926
    //           },
    //           {
    //             "X": 0.7609517574310303,
    //             "Y": 0.17080500721931458
    //           },
    //           {
    //             "X": 0.6641513109207153,
    //             "Y": 0.17068752646446228
    //           }
    //         ]
    //       },
    //       "Id": "5decb4b9-fa44-4b74-a410-d753ca9da87e",
    //       "Text": "of",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.94082641601562,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.1432349979877472,
    //           "Left": 0.02354392223060131,
    //           "Top": 0.24356883764266968,
    //           "Width": 0.25458571314811707
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.023637553676962852,
    //             "Y": 0.24356883764266968
    //           },
    //           {
    //             "X": 0.2781296372413635,
    //             "Y": 0.2438821941614151
    //           },
    //           {
    //             "X": 0.2780475318431854,
    //             "Y": 0.38680383563041687
    //           },
    //           {
    //             "X": 0.02354392223060131,
    //             "Y": 0.38648173213005066
    //           }
    //         ]
    //       },
    //       "Id": "df38a25e-1237-4837-9c73-2628cf2a60d6",
    //       "Text": "times,",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98735046386719,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.11849363893270493,
    //           "Left": 0.3037284016609192,
    //           "Top": 0.24306905269622803,
    //           "Width": 0.0635330006480217
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.3037954568862915,
    //             "Y": 0.24306905269622803
    //           },
    //           {
    //             "X": 0.3672614097595215,
    //             "Y": 0.24314717948436737
    //           },
    //           {
    //             "X": 0.3671967089176178,
    //             "Y": 0.36156269907951355
    //           },
    //           {
    //             "X": 0.3037284016609192,
    //             "Y": 0.36148273944854736
    //           }
    //         ]
    //       },
    //       "Id": "4006856d-989a-413a-a19d-ba58464056c7",
    //       "Text": "it",
    //       "TextType": "HANDWRITING"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9149398803711,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.08177535980939865,
    //           "Left": 0.38862472772598267,
    //           "Top": 0.27884912490844727,
    //           "Width": 0.15473271906375885
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.3886687457561493,
    //             "Y": 0.27884912490844727
    //           },
    //           {
    //             "X": 0.5433574318885803,
    //             "Y": 0.2790408730506897
    //           },
    //           {
    //             "X": 0.543317437171936,
    //             "Y": 0.3606244921684265
    //           },
    //           {
    //             "X": 0.38862472772598267,
    //             "Y": 0.36042970418930054
    //           }
    //         ]
    //       },
    //       "Id": "0cefb90d-9771-4a62-b47b-f4653f5a5fdc",
    //       "Text": "was",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.99311828613281,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12356647849082947,
    //           "Left": 0.5699390172958374,
    //           "Top": 0.2369067519903183,
    //           "Width": 0.13684332370758057
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.5699985027313232,
    //             "Y": 0.2369067519903183
    //           },
    //           {
    //             "X": 0.706782341003418,
    //             "Y": 0.23707492649555206
    //           },
    //           {
    //             "X": 0.7067282199859619,
    //             "Y": 0.3604732155799866
    //           },
    //           {
    //             "X": 0.5699390172958374,
    //             "Y": 0.3603009879589081
    //           }
    //         ]
    //       },
    //       "Id": "b090e2a0-59cb-483a-8489-eb7367c3ec42",
    //       "Text": "the",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.92478942871094,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.09358794242143631,
    //           "Left": 0.7283655405044556,
    //           "Top": 0.26839619874954224,
    //           "Width": 0.23684848845005035
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.7284058332443237,
    //             "Y": 0.26839619874954224
    //           },
    //           {
    //             "X": 0.9652140140533447,
    //             "Y": 0.2686891257762909
    //           },
    //           {
    //             "X": 0.9651807546615601,
    //             "Y": 0.36198413372039795
    //           },
    //           {
    //             "X": 0.7283655405044556,
    //             "Y": 0.3616859018802643
    //           }
    //         ]
    //       },
    //       "Id": "584e024d-cdb8-4991-964a-a6c00a219b4d",
    //       "Text": "worst",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9924087524414,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12504424154758453,
    //           "Left": 0.023733235895633698,
    //           "Top": 0.42446625232696533,
    //           "Width": 0.09820675849914551
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.023815063759684563,
    //             "Y": 0.42446625232696533
    //           },
    //           {
    //             "X": 0.1219399943947792,
    //             "Y": 0.4245913326740265
    //           },
    //           {
    //             "X": 0.12186205387115479,
    //             "Y": 0.5495104789733887
    //           },
    //           {
    //             "X": 0.023733235895633698,
    //             "Y": 0.5493824481964111
    //           }
    //         ]
    //       },
    //       "Id": "9e7fcad8-5fac-497e-941c-6af065273c4f",
    //       "Text": "of",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.96434020996094,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.14146748185157776,
    //           "Left": 0.1365714967250824,
    //           "Top": 0.43465203046798706,
    //           "Width": 0.2509154975414276
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.1366589069366455,
    //             "Y": 0.43465203046798706
    //           },
    //           {
    //             "X": 0.38748699426651,
    //             "Y": 0.43497234582901
    //           },
    //           {
    //             "X": 0.3874107897281647,
    //             "Y": 0.5761194825172424
    //           },
    //           {
    //             "X": 0.1365714967250824,
    //             "Y": 0.5757906436920166
    //           }
    //         ]
    //       },
    //       "Id": "06fa7250-a384-44b1-a821-f4961437dab8",
    //       "Text": "times,",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98502349853516,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.11561936885118484,
    //           "Left": 0.4144190847873688,
    //           "Top": 0.43338337540626526,
    //           "Width": 0.06467052549123764
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.41448044776916504,
    //             "Y": 0.43338337540626526
    //           },
    //           {
    //             "X": 0.479089617729187,
    //             "Y": 0.4334658682346344
    //           },
    //           {
    //             "X": 0.4790306091308594,
    //             "Y": 0.5490027666091919
    //           },
    //           {
    //             "X": 0.4144190847873688,
    //             "Y": 0.5489184856414795
    //           }
    //         ]
    //       },
    //       "Id": "a5856e1f-1c35-4fd8-9d5c-ec112ce446da",
    //       "Text": "it",
    //       "TextType": "HANDWRITING"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.91905975341797,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.08224299550056458,
    //           "Left": 0.49934622645378113,
    //           "Top": 0.4678362309932709,
    //           "Width": 0.15544551610946655
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.49938759207725525,
    //             "Y": 0.4678362309932709
    //           },
    //           {
    //             "X": 0.6547917127609253,
    //             "Y": 0.4680359363555908
    //           },
    //           {
    //             "X": 0.6547544002532959,
    //             "Y": 0.5500792264938354
    //           },
    //           {
    //             "X": 0.49934622645378113,
    //             "Y": 0.5498764514923096
    //           }
    //         ]
    //       },
    //       "Id": "5d92695a-2ef5-4175-8483-955bdd21c8c5",
    //       "Text": "was",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.99500274658203,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12332675606012344,
    //           "Left": 0.6814824938774109,
    //           "Top": 0.4259999394416809,
    //           "Width": 0.13685987889766693
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.6815374493598938,
    //             "Y": 0.4259999394416809
    //           },
    //           {
    //             "X": 0.8183423280715942,
    //             "Y": 0.4261743724346161
    //           },
    //           {
    //             "X": 0.8182926774024963,
    //             "Y": 0.5493267178535461
    //           },
    //           {
    //             "X": 0.6814824938774109,
    //             "Y": 0.5491482615470886
    //           }
    //         ]
    //       },
    //       "Id": "145e3940-2b15-4b0f-a1ef-c1eec67bfd34",
    //       "Text": "the",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98210144042969,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12430953234434128,
    //           "Left": 0.8426083326339722,
    //           "Top": 0.46473923325538635,
    //           "Width": 0.13991668820381165
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.8426574468612671,
    //             "Y": 0.46473923325538635
    //           },
    //           {
    //             "X": 0.9825250506401062,
    //             "Y": 0.464918851852417
    //           },
    //           {
    //             "X": 0.9824814200401306,
    //             "Y": 0.5890488028526306
    //           },
    //           {
    //             "X": 0.8426083326339722,
    //             "Y": 0.5888649821281433
    //           }
    //         ]
    //       },
    //       "Id": "979e61b4-b915-4001-8761-e417fb5bcc88",
    //       "Text": "age",
    //       "TextType": "HANDWRITING"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9930419921875,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12172402441501617,
    //           "Left": 0.023001601919531822,
    //           "Top": 0.6150603294372559,
    //           "Width": 0.09997083991765976
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.023081274703145027,
    //             "Y": 0.6150603294372559
    //           },
    //           {
    //             "X": 0.12297244369983673,
    //             "Y": 0.615192174911499
    //           },
    //           {
    //             "X": 0.12289661169052124,
    //             "Y": 0.7367843389511108
    //           },
    //           {
    //             "X": 0.023001601919531822,
    //             "Y": 0.7366495132446289
    //           }
    //         ]
    //       },
    //       "Id": "477b9395-e813-4f47-8f6c-bbc6fd2a1b1d",
    //       "Text": "of",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.74298858642578,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.14897798001766205,
    //           "Left": 0.12940004467964172,
    //           "Top": 0.6157097220420837,
    //           "Width": 0.3510173559188843
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.12949234247207642,
    //             "Y": 0.6157097220420837
    //           },
    //           {
    //             "X": 0.480417400598526,
    //             "Y": 0.6161730885505676
    //           },
    //           {
    //             "X": 0.4803416132926941,
    //             "Y": 0.7646876573562622
    //           },
    //           {
    //             "X": 0.12940004467964172,
    //             "Y": 0.7642117142677307
    //           }
    //         ]
    //       },
    //       "Id": "cb715516-6798-4db7-922e-aaa05c999497",
    //       "Text": "wisdom,",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98406982421875,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.11607321351766586,
    //           "Left": 0.5076302886009216,
    //           "Top": 0.6217586398124695,
    //           "Width": 0.06478644162416458
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.5076884627342224,
    //             "Y": 0.6217586398124695
    //           },
    //           {
    //             "X": 0.5724167227745056,
    //             "Y": 0.6218441724777222
    //           },
    //           {
    //             "X": 0.5723609328269958,
    //             "Y": 0.7378318309783936
    //           },
    //           {
    //             "X": 0.5076302886009216,
    //             "Y": 0.7377444505691528
    //           }
    //         ]
    //       },
    //       "Id": "ff4bbb55-0ab1-4c91-a910-c44da34f3702",
    //       "Text": "it",
    //       "TextType": "HANDWRITING"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.90616607666016,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.08252032846212387,
    //           "Left": 0.5927665829658508,
    //           "Top": 0.655697226524353,
    //           "Width": 0.15431776642799377
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.5928056836128235,
    //             "Y": 0.655697226524353
    //           },
    //           {
    //             "X": 0.747084379196167,
    //             "Y": 0.6559024453163147
    //           },
    //           {
    //             "X": 0.7470493316650391,
    //             "Y": 0.7382175922393799
    //           },
    //           {
    //             "X": 0.5927665829658508,
    //             "Y": 0.7380093336105347
    //           }
    //         ]
    //       },
    //       "Id": "8eae93f4-70a2-4723-b532-e52dfdde18fc",
    //       "Text": "was",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9914321899414,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12222800403833389,
    //           "Left": 0.775054395198822,
    //           "Top": 0.6142479777336121,
    //           "Width": 0.13469739258289337
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.7751052975654602,
    //             "Y": 0.6142479777336121
    //           },
    //           {
    //             "X": 0.909751832485199,
    //             "Y": 0.6144257187843323
    //           },
    //           {
    //             "X": 0.9097061157226562,
    //             "Y": 0.736475944519043
    //           },
    //           {
    //             "X": 0.775054395198822,
    //             "Y": 0.7362942695617676
    //           }
    //         ]
    //       },
    //       "Id": "7a25756d-68e2-45ec-bef4-f919294fecb3",
    //       "Text": "the",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.98051452636719,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12403102964162827,
    //           "Left": 0.02215408906340599,
    //           "Top": 0.8438721299171448,
    //           "Width": 0.1418474167585373
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.022235259413719177,
    //             "Y": 0.8438721299171448
    //           },
    //           {
    //             "X": 0.16400150954723358,
    //             "Y": 0.8440671563148499
    //           },
    //           {
    //             "X": 0.163925901055336,
    //             "Y": 0.967903196811676
    //           },
    //           {
    //             "X": 0.02215408906340599,
    //             "Y": 0.9677039980888367
    //           }
    //         ]
    //       },
    //       "Id": "5763091d-4807-44b0-94d6-1f6fba7c66ad",
    //       "Text": "age",
    //       "TextType": "PRINTED"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.9867935180664,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12490887939929962,
    //           "Left": 0.18867632746696472,
    //           "Top": 0.7999078035354614,
    //           "Width": 0.09571950137615204
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.18875153362751007,
    //             "Y": 0.7999078035354614
    //           },
    //           {
    //             "X": 0.28439584374427795,
    //             "Y": 0.8000383377075195
    //           },
    //           {
    //             "X": 0.28432440757751465,
    //             "Y": 0.9248167276382446
    //           },
    //           {
    //             "X": 0.18867632746696472,
    //             "Y": 0.9246832728385925
    //           }
    //         ]
    //       },
    //       "Id": "f08b6956-7c97-4877-83e2-f495b3983963",
    //       "Text": "of",
    //       "TextType": "HANDWRITING"
    //     },
    //     {
    //       "BlockType": "WORD",
    //       "Confidence": 99.82215881347656,
    //       "Geometry": {
    //         "BoundingBox": {
    //           "Height": 0.12534499168395996,
    //           "Left": 0.3012242317199707,
    //           "Top": 0.8001948595046997,
    //           "Width": 0.4566299617290497
    //         },
    //         "Polygon": [
    //           {
    //             "X": 0.3012949526309967,
    //             "Y": 0.8001948595046997
    //           },
    //           {
    //             "X": 0.7578542232513428,
    //             "Y": 0.8008179664611816
    //           },
    //           {
    //             "X": 0.7578015327453613,
    //             "Y": 0.9255398511886597
    //           },
    //           {
    //             "X": 0.3012242317199707,
    //             "Y": 0.9249030947685242
    //           }
    //         ]
    //       },
    //       "Id": "275f5f9f-fcd6-4447-8242-c6e777fc762a",
    //       "Text": "foolishness",
    //       "TextType": "PRINTED"
    //     }
    //   ],
    //   "DetectDocumentTextModelVersion": "1.0",
    //   "DocumentMetadata": {
    //     "Pages": 1
    //   }
    // }


End_Procedure