Source:
<code>public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); SyncPoller<OperationResult, List<FormPage>> recognizeLayoutPoller = client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG); <START> List<FormPage> contentPageResults = recognizeLayoutPoller.getFinalResult(); <END> for (int i = 0; i < contentPageResults.size(); i++) { final FormPage formPage = contentPageResults.get(i); System.out.printf("----Recognizing content for page %s ----", i); 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(); }); } }</code><technical_language>changing name of layoutPageResults -> contentPageResults, I a good idea change recognizeLayoutPoller -> recognizeContentPoller</technical_language>

Target:
public static void main(final String[] args) throws IOException { FormRecognizerClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/layout1.jpg"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); InputStream targetStream = new ByteArrayInputStream(fileContent); SyncPoller<OperationResult, List<FormPage>> recognizeContentPoller = client.beginRecognizeContent(targetStream, sourceFile.length(), FormContentType.IMAGE_JPEG); List<FormPage> contentPageResults = recognizeContentPoller.getFinalResult(); for (int i = 0; i < contentPageResults.size(); i++) { final FormPage formPage = contentPageResults.get(i); System.out.printf("----Recognizing content for page %s ----", i); System.out.printf("Has width: %s and height: %s, measured with unit: %s%n", formPage.getWidth(), formPage.getHeight(), formPage.getUnit()); final List<FormTable> tables = formPage.getTables(); for (int i1 = 0; i1 < tables.size(); i1++) { final FormTable formTable = tables.get(i1); System.out.printf("Table %s has %s rows and %s columns.%n", i1, 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(); } } }