1

I am using Document AI for reading invoices by calling the endpoint and then parsing the response JSON to get entities information.

One example of entity JSON data:

enter image description here

Do you know how to get the coordinate for each entity?

Thanks a lot and any input would be appreciated.

Holt Skinner
  • 1,692
  • 1
  • 8
  • 21
laventy
  • 75
  • 2
  • 6
  • Depends which language you're using. If you're using JavaScript, you can directly manipulate a JSON object like such `const coordinates = objectName.textAnchor.textSegments[0]; const start = coordinates.startIndex; const end = coordinates.endIndex` – JKleinne Jul 29 '20 at 17:09
  • @JKleinne hey thanks for your response. but the startIndex and endIndex have nothing to do with coordinates of this entity. Instead, they refer to the start and end positions/indexes of the entity value. – laventy Aug 09 '20 at 08:55

1 Answers1

0

You can get the bounding boxes of Entities (or any layout elements in Document AI) in the pageAnchor field.

The handle the processing response page in the documentation has information and illustrations about the structure of the output Document structure.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Holt Skinner
  • 1,692
  • 1
  • 8
  • 21