Source:
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); PollerFlux<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContentFromUrl("file_source_url"); Mono<IterableStream<FormPage>> layoutPageResults = recognizeLayoutPoller .last() .flatMap(trainingOperationResponse -> { if (trainingOperationResponse.getStatus().isComplete()) { return trainingOperationResponse.getFinalResult(); } else { return Mono.error(new RuntimeException("Polling completed unsuccessfully with status:" + trainingOperationResponse.getStatus())); } }); layoutPageResults.subscribe(formPages -> formPages.forEach(formPage -> { System.out.println("----Recognizing content ----"); System.out.printf("Has width: %s and height: %s, measured with unit: %s%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %s rows and %s columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> { final StringBuilder boundingBoxStr = new StringBuilder(); if (formTableCell.getBoundingBox() != null) { formTableCell.getBoundingBox().getPoints().forEach(point -> boundingBoxStr.append(String.format("[%s, %s]", point.getX(), point.getY()))); } System.out.printf("Cell has text %s, within bounding box %s.%n", formTableCell.getText(), boundingBoxStr); }); System.out.println(); }); })); try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public static void main(final String[] args) { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .apiKey(new AzureKeyCredential("{api_key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); PollerFlux<OperationResult, IterableStream<FormPage>> recognizeLayoutPoller = client.beginRecognizeContentFromUrl("<LINK_0>"); Mono<IterableStream<FormPage>> layoutPageResults = recognizeLayoutPoller .last() .flatMap(trainingOperationResponse -> { if (trainingOperationResponse.getStatus().isComplete()) { return trainingOperationResponse.getFinalResult(); } else { return Mono.error(new RuntimeException("Polling completed unsuccessfully with status:" + trainingOperationResponse.getStatus())); } }); layoutPageResults.subscribe(formPages -> formPages.forEach(formPage -> { System.out.println("----Recognizing content ----"); System.out.printf("Has width: %s and height: %s, measured with unit: %s%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); formPage.getTables().forEach(formTable -> { System.out.printf("Table has %s rows and %s columns.%n", formTable.getRowCount(), formTable.getColumnCount()); formTable.getCells().forEach(formTableCell -> { final StringBuilder boundingBoxStr = new StringBuilder(); if (formTableCell.getBoundingBox() != null) { formTableCell.getBoundingBox().getPoints().forEach(point -> boundingBoxStr.append(String.format("[%.2f, %.2f]", point.getX(), point.getY()))); } System.out.printf("Cell has text %s, within bounding box %s.%n", formTableCell.getText(), boundingBoxStr); }); System.out.println(); }); })); try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }