Document Intelligence prebuilt models...getting raw + structured text

Robert V 20 Reputation points
2025-04-05T19:02:39.0033333+00:00

Using Document Intelligence prebuilt models to process receipts, is it possible to obtain a raw text output of the entire receipt alongside the structured data extracted by the model? Currently, the OCR identifies some text not included in prebuilt fields, highlighted in light yellow in Document Intelligence Studio, but without bounding boxes. The text I need is in those sections and is trivially identified by regular expression, if only I had the text.

At the moment, I have to run the receipt through both OCR/Read and the receipt model, but this is probably wasteful since there is likely redundant processing, and is definitely more costly. Is there a way to obtain a raw text dump and the structured data from the prebuilt models at once?

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

Accepted answer
  1. Vinodh247 34,661 Reputation points MVP Volunteer Moderator
    2025-04-06T12:34:27.6266667+00:00

    Hi ,

    Thanks for reaching out to Microsoft Q&A.

    You are right in your observation—when using Azure Document Intelligence (formerly Form Recognizer), especially the prebuilt models like prebuilt-receipt, the raw OCR output is not directly returned as-is along with the structured data.

    However, here is the practical breakdown of your options:


    1. Behavior of Prebuilt Models (prebuilt-receipt)
    • The prebuilt models do run OCR under the hood.
    • They extract structured fields (merchant name, total, tax, items).

    Additional text present on the receipt but not part of the structured schema may not be exposed in the response (this is what you are seeing as highlighted in yellow in the studio).

    Issue: This "extra" text is only partially exposed and does not include bounding boxes or full OCR data. It is not included in the API response unless specifically accessed.

    1. Why using both Read & Receipt model is wasteful

    You are absolutely right. Using both:

    Read model: gives you raw OCR text and layout (bounding boxes, lines, words).

    prebuilt-receipt model: gives structured receipt fields but does not expose full raw OCR text.

    Running both results in duplicate OCR processing and higher cost.

    1. Best Practice: Use prebuilt-receipt with includeTextDetails=true

    When you call the prebuilt-receipt API, set the parameter:You are right in your observation—when using Azure Document Intelligence (formerly Form Recognizer), especially the prebuilt models like prebuilt-receipt, the raw OCR output is not directly returned as-is along with the structured data. However, here is the practical breakdown of your options --> includeTextDetails=true

    This gives you:

    The structured fields (MerchantName, Items, Total, etc.).

    And also all raw OCR text, including bounding boxes, line text, words, and positions.

    This is what you need to extract that "yellow highlighted" text using your own regex.

    1. Output Structure with includeTextDetails

    You can expect in the response:

    • analyzeResult.readResults --> Full raw OCR text, by page, with bounding boxes and lines.
    • analyzeResult.documentResults -> Structured receipt data.

    So, you do not need to run Read separately. The prebuilt-receipt model with includeTextDetails=true gives you everything in one shot.

    Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Robert V 20 Reputation points
    2025-04-08T23:26:53.7+00:00

    Thank you! I'll give it a try and will report back.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.