[formrecognizer] fix readme sample
Resolves
@@ -236,9 +236,10 @@ with open("<path to your form>", "rb") as fd:
form = fd.read()
poller = form_recognizer_client.begin_recognize_content(form)
-page = poller.result()
+form_pages = poller.result()
-table = page[0].tables[0] # page 1, table 1
+for content in form_pages:
+ for table in content.tables:
print("Table found on page {}:".format(table.page_number))
print("Table location {}:".format(table.bounding_box))
for cell in table.cells:
@@ -246,8 +247,9 @@ for cell in table.cells:
print("Location: {}".format(cell.bounding_box))
print("Confidence score: {}\n".format(cell.confidence))
-print("Selection marks found on page {}:".format(page[0].page_number))
-for selection_mark in page[0].selection_marks:
+ if content.selection_marks:
+ print("Selection marks found on page {}:".format(content.page_number))
+ for selection_mark in content.selection_marks:
print("Selection mark is '{}' within bounding box '{}' and has a confidence of {}".format(
selection_mark.state,
selection_mark.bounding_box,
