(textAnchor, text)
| 145 | |
| 146 | // Extract shards from the text field |
| 147 | const getText = (textAnchor, text) => { |
| 148 | if (!textAnchor.textSegments || textAnchor.textSegments.length === 0) { |
| 149 | return ''; |
| 150 | } |
| 151 | |
| 152 | // First shard in document doesn't have startIndex property |
| 153 | const startIndex = textAnchor.textSegments[0].startIndex || 0; |
| 154 | const endIndex = textAnchor.textSegments[0].endIndex; |
| 155 | |
| 156 | return text.substring(startIndex, endIndex); |
| 157 | }; |
| 158 | |
| 159 | // [END documentai_process_ocr_document] |
| 160 | await processDocument(); |
no outgoing calls
no test coverage detected