@@ -236,23 +236,25 @@ with open("<path to your form>", "rb") as fd:
236236 form = fd.read()
237237
238238poller = form_recognizer_client.begin_recognize_content(form)
239- page = poller.result()
240-
241- table = page[0 ].tables[0 ] # page 1, table 1
242- print (" Table found on page {} :" .format(table.page_number))
243- print (" Table location {} :" .format(table.bounding_box))
244- for cell in table.cells:
245- print (" Cell text: {} " .format(cell.text))
246- print (" Location: {} " .format(cell.bounding_box))
247- print (" Confidence score: {} \n " .format(cell.confidence))
248-
249- print (" Selection marks found on page {} :" .format(page[0 ].page_number))
250- for selection_mark in page[0 ].selection_marks:
251- print (" Selection mark is '{} ' within bounding box '{} ' and has a confidence of {} " .format(
252- selection_mark.state,
253- selection_mark.bounding_box,
254- selection_mark.confidence
255- ))
239+ form_pages = poller.result()
240+
241+ for content in form_pages:
242+ for table in content.tables:
243+ print (" Table found on page {} :" .format(table.page_number))
244+ print (" Table location {} :" .format(table.bounding_box))
245+ for cell in table.cells:
246+ print (" Cell text: {} " .format(cell.text))
247+ print (" Location: {} " .format(cell.bounding_box))
248+ print (" Confidence score: {} \n " .format(cell.confidence))
249+
250+ if content.selection_marks:
251+ print (" Selection marks found on page {} :" .format(content.page_number))
252+ for selection_mark in content.selection_marks:
253+ print (" Selection mark is '{} ' within bounding box '{} ' and has a confidence of {} " .format(
254+ selection_mark.state,
255+ selection_mark.bounding_box,
256+ selection_mark.confidence
257+ ))
256258```
257259
258260### Recognize Receipts
0 commit comments