styles field is coming blank in the ai-form-recognizer api response

Aicte Team 0 Reputation points
2023-08-08T05:14:21.29+00:00

Hi,

I am using the ai-form-recognizer api since last one week and I was getting the styles field in the response but last 2 days, not getting the styles field.

I have not changed anything the code.

I have checked with S0 Standard services also but not getting the styles field.

Here is the my sample code.

try {

    const analyzeOptions = {
      modelVersionId: "prebuilt-read",
      apiVersion: "2023-02-28-preview", // API version
      stringIndexType: "utf16CodeUnit", // String index type
      features: [{
        'ocr': {
          'font': true
        }
      }], // Features
      pages: "1"
    };

     // Analyze the document with options
     const poller = await client.beginAnalyzeDocument("prebuilt-read", documentUrl, analyzeOptions);

     // Wait for the analysis to complete
     const { content, pages, languages, styles } = await poller.pollUntilDone();
     const ocrResult = JSON.stringify(styles);
     console.log("Styles:", ocrResult);

  } catch (error) {
    console.error("Analyze error:", error.message);
  }

If anyone have any idea about this issue, Please let me know how to resolve this issue.

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,507 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 43,656 Reputation points Microsoft Employee
    2023-08-08T12:40:10.2+00:00

    @Aicte Team I see you are using a preview version of the API "2023-02-28-preview" and as per the reference from this page, the reference does not list style font as a feature. For preview versions of the API, support for features can be added or deleted so it is better to use the GA version of the API which is latest i.e v3.1 and check if you get the required response.

    Try using API version for v3.1 2023-07-31 and add feature styleFont for prebuilt-read model. See the reference here. The response object might also change and you might want to first print the complete result or use the REST API from the reference page and then change your code to print the required fields of the response. Thanks!!

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments