# Source: https://docs.aimlapi.com/api-references/vision-models/ocr-optical-character-recognition/mistral-ai/mistral-ocr-latest.md

# mistral-ocr-latest

{% hint style="info" %}
This documentation is valid for the following list of our models:

* `mistral/mistral-ocr-latest`
  {% endhint %}

## Model Overview

This Optical Character Recognition API from Mistral sets a new standard in document understanding. Unlike other models, Mistral OCR comprehends each element of documents—media, text, tables, equations—with unprecedented accuracy and cognition. It takes images and PDFs as input and extracts content in an ordered interleaved text and images.

Maximum file size: `50` MB.\
Maximum number of pages: `1000`.

{% hint style="warning" %}
Note that this OCR does not preserve character formatting: bold, underline, italics, monospace text, etc.\
However, it preserves footnotes (superscript text).
{% endhint %}

## Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).

## How to Make a Call

<details>

<summary>Step-by-Step Instructions</summary>

* Copy the code from one of the [examples](#example-1-process-a-pdf-file) below, depending on whether you want to process an image or a PDF.
* Replace `<YOUR_AIMLAPI_KEY>` with your AIML API key from [your personal account](https://aimlapi.com/app/keys).
* Replace the URL of the document or image with the one you need.
* If you need to use different parameters, refer to the API schema below for valid values and operational logic.
* Save the modified code as a Python file and run it in an IDE[^1] or via the console.

</details>

## API Schema

## Extract text from images using OCR.

> Performs optical character recognition (OCR) to extract text from images, enabling text-based analysis, data extraction, and automation workflows from visual data.

```json
{"openapi":"3.0.0","info":{"title":"AI/ML Gateway","version":"1.0"},"servers":[{"url":"https://api.aimlapi.com"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"<YOUR_AIMLAPI_KEY>","type":"http","description":"Bearer key"}},"schemas":{"Vision.v1.OCRResponseDTO":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"The page index in a PDF document starting from 0"},"markdown":{"type":"string","description":"The markdown string response of the page"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Image ID for extracted image in a page"},"top_left_x":{"type":"integer","nullable":true,"description":"X coordinate of top-left corner of the extracted image"},"top_left_y":{"type":"integer","nullable":true,"description":"Y coordinate of top-left corner of the extracted image"},"bottom_right_x":{"type":"integer","nullable":true,"description":"X coordinate of bottom-right corner of the extracted image"},"bottom_right_y":{"type":"integer","nullable":true,"description":"Y coordinate of bottom-right corner of the extracted image"},"image_base64":{"type":"string","nullable":true,"format":"uri","description":"Base64 string of the extracted image"}},"required":["id","top_left_x","top_left_y","bottom_right_x","bottom_right_y"]},"description":"List of all extracted images in the page"},"dimensions":{"type":"object","nullable":true,"properties":{"dpi":{"type":"integer","description":"Dots per inch of the page-image."},"height":{"type":"integer","description":"Height of the image in pixels."},"width":{"type":"integer","description":"Width of the image in pixels."}},"required":["dpi","height","width"],"description":"The dimensions of the PDF page's screenshot image"}},"required":["index","markdown","images","dimensions"]},"description":"List of OCR info for pages"},"model":{"type":"string","enum":["mistral-ocr-latest"],"description":"The model used to generate the OCR."},"usage_info":{"type":"object","properties":{"pages_processed":{"type":"integer","description":"Number of pages processed"},"doc_size_bytes":{"type":"integer","nullable":true,"description":"Document size in bytes"}},"required":["pages_processed","doc_size_bytes"],"description":"Usage info for the OCR request."}},"required":["pages","model","usage_info"]}}},"paths":{"/v1/ocr":{"post":{"operationId":"DocumentModelsController_processOCRRequest_v1","summary":"Extract text from images using OCR.","description":"Performs optical character recognition (OCR) to extract text from images, enabling text-based analysis, data extraction, and automation workflows from visual data.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"enum":["mistral/mistral-ocr-latest"]},"document":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["document_url"],"description":"Type of document."},"document_url":{"type":"string","format":"uri","description":"Document URL."}},"required":["type","document_url"]},{"type":"object","properties":{"type":{"type":"string","enum":["image_url"],"description":"Image URL."},"image_url":{"type":"string","format":"uri","description":"Type of document."}},"required":["type","image_url"]}],"description":"Document to run OCR"},"pages":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"integer"}},{"nullable":true}],"description":"Specific pages you wants to process"},"include_image_base64":{"type":"boolean","nullable":true,"description":"Include base64 images in response"},"image_limit":{"type":"integer","nullable":true,"description":"Max images to extract"},"image_min_size":{"type":"integer","nullable":true,"description":"Minimum height and width of image to extract"}},"required":["document"]}}}},"responses":{"201":{"description":"Successfully processed document with OCR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vision.v1.OCRResponseDTO"}}}}},"tags":["Vision Models"]}}}}
```

## Example #1: Text Recognition From an Image

We’ve found a photo of a short handwritten text for OCR testing and will be passing it to the model via URL:

<figure><img src="https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-e27039a694910b23e18ecdfb8c153396d4418649%2Fhx0v4fj979k51.jpg?alt=media" alt="" width="563"><figcaption><p>Thanks, <a href="https://www.reddit.com/r/Handwriting/comments/ijq9nv/first_handwriting_sample_after_practice/">Reddit</a>!</p></figcaption></figure>

{% code overflow="wrap" %}

```python
import requests

def main():
    response = requests.post(
        "https://api.aimlapi.com/v1/ocr",
        headers={
            "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
            "Content-Type": "application/json",
        },
        json={
            "document": {
                "type": "image_url",
                "image_url": "https://i.redd.it/hx0v4fj979k51.jpg"
            },
            "model": "mistral/mistral-ocr-latest",
        },
    )

    # response.raise_for_status()
    data = response.json()
    # print(data)
    
    return data

main()
```

{% endcode %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json5
{'pages': [{'index': 0,
   'markdown': 'This is a handwriting test to see how it looks on lined paper. For the past two weeks I have been trying to improve my writing along with learning hows to write with maintain pens. If you have any suggestions, tips or free resources I would love to check it out. Hope everyone is having a good day.',
   'images': [],
   'dimensions': {'dpi': 200, 'height': 2789, 'width': 3024}}],
 'model': 'mistral-ocr-2503-completion',
 'usage_info': {'pages_processed': 1, 'doc_size_bytes': 573156}}
```

{% endcode %}

</details>

## Example #2: Process a PDF File

Let's process a PDF file from the internet using the described model:

{% code overflow="wrap" %}

```python
import requests


def main():
    response = requests.post(
        "https://api.aimlapi.com/v1/ocr",
        headers={
            "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
            "Content-Type": "application/json",
        },
        json={
            "document": {
                "type": "document_url",
                "document_url": "https://css4.pub/2015/textbook/somatosensory.pdf"
            },
            "model": "mistral/mistral-ocr-latest",
        },
    )

    response.raise_for_status()
    data = response.json()

    print(data)


if __name__ == "__main__":
    main()
    
```

{% endcode %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json5
{'pages': [{'index': 0, 'markdown': "# Anatomy of the Somatosensory System \n\nFrom Wiкibooks ${ }^{1}$\n\nOur somatosensory system consists of sensors in the skin and sensors in our muscles, tendons, and joints. The receptors in the skin, the so called cutaneous receptors, tell us about temperature (thermoreceptors), pressure and surface texture (mechano receptors), and pain (nociceptors). The receptors in muscles and joints provide information about muscle length, muscle tension, and joint angles.\n\n## Cutaneous receptors\n\nSensory information from Meissner corpuscles and rapidly adapting afferents leads to adjustment of grip force when objects are lifted. These afferents respond with a brief burst of action potentials when objects move a small distance during the early stages of lifting. In response to\n![img-0.jpeg](img-0.jpeg)\n\nThis is a sample document to showcase page-based formatting. It contains a chapter from a Wikibook called Sensory Systems. None of the content has been changed in this article, but some content has been removed.\n\nFigure 1: Receptors in the human skin: Mechanoreceptors can be free receptors or encapsulated. Examples for free receptors are the hair receptors at the roots of hairs. Encapsulated receptors are the Pacinian corpuscles and the receptors in the glabrous (hairless) skin: Meissner corpuscles, Ruffini corpuscles and Merkel's disks.\n\n[^0]\n[^0]:    ${ }^{1}$ The following description is based on lecture notes from Laszlo Zaborszky, from Rutgers University.", 'images': [{'id': 'img-0.jpeg', 'top_left_x': 155, 'top_left_y': 1073, 'bottom_right_x': 937, 'bottom_right_y': 1694, 'image_base64': None}], 'dimensions': {'dpi': 200, 'height': 1970, 'width': 1575}}, {'index': 1, 'markdown': "Figure 2: Mammalian muscle spindle showing typical position in a muscle (left), neuronal connections in spinal cord (middle) and expanded schematic (right). The spindle is a stretch receptor with its own motor supply consisting of several intrafusal muscle fibres. The sensory endings of a primary (group Ia) afferent and a secondary (group II) afferent coil around the non-contractile central portions of the intrafusal fibres.\n![img-1.jpeg](img-1.jpeg)\nrapidly adapting afferent activity, muscle force increases reflexively until the gripped object no longer moves. Such a rapid response to a tactile stimulus is a clear indication of the role played by somatosensory neurons in motor activity.\n\nThe slowly adapting Merkel's receptors are responsible for form and texture perception. As would be expected for receptors mediating form perception, Merkel's receptors are present at high density in the digits and around the mouth ( $50 / \\mathrm{mm}^{2}$ of skin surface), at lower density in other glabrous surfaces, and at very low density in hairy skin. This innervations density shrinks progressively with the passage of time so that by the age of 50 , the density in human digits is reduced to $10 / \\mathrm{mm}^{2}$. Unlike rapidly adapting axons, slowly adapting fibers respond not only to the initial indentation of skin, but also to sustained indentation up to several seconds in duration.\n\nActivation of the rapidly adapting Pacinian corpuscles gives a feeling of vibration, while the slowly adapting Ruffini corpuscles respond to the lataral movement or stretching of skin.\n\n## Nociceptors\n\nNociceptors have free nerve endings. Functionally, skin nociceptors are either high-threshold mechanoreceptors", 'images': [{'id': 'img-1.jpeg', 'top_left_x': 606, 'top_left_y': 228, 'bottom_right_x': 1431, 'bottom_right_y': 705, 'image_base64': None}], 'dimensions': {'dpi': 200, 'height': 1970, 'width': 1575}}, {'index': 2, 'markdown': '|  | Rapidly adapting | Slowly adapting |\n| :-- | :-- | :-- |\n| Surface receptor / <br> small receptive <br> field | Hair receptor, Meissner\'s corpuscle: De- <br> tect an insect or a very fine vibration. <br> Used for recognizing texture. | Merkel\'s receptor: Used for spa- <br> tial details, e.g. a round surface <br> edge or "an X" in brail. |\n| Deep receptor / <br> large receptive <br> field | Pacinian corpuscle: "A diffuse vibra- <br> tion" e.g. tapping with a pencil. | Ruffini\'s corpuscle: "A skin <br> stretch". Used for joint position <br> in fingers. |\n\nTable 1\nor polymodal receptors. Polymodal receptors respond not only to intense mechanical stimuli, but also to heat and to noxious chemicals. These receptors respond to minute punctures of the epithelium, with a response magnitude that depends on the degree of tissue deformation. They also respond to temperatures in the range of $40-60^{\\circ} \\mathrm{C}$, and change their response rates as a linear function of warming (in contrast with the saturating responses displayed by non-noxious thermoreceptors at high temperatures).\n\nPain signals can be separated into individual components, corresponding to different types of nerve fibers used for transmitting these signals. The rapidly transmitted signal, which often has high spatial resolution, is called first pain or cutaneous pricking pain. It is well localized and easily tolerated. The much slower, highly affective component is called second pain or burning pain; it is poorly localized and poorly tolerated. The third or deep pain, arising from viscera, musculature and joints, is also poorly localized, can be chronic and is often associated with referred pain.\n\n## Muscle Spindles\n\nScattered throughout virtually every striated muscle in the body are long, thin, stretch receptors called muscle spindles. They are quite simple in principle, consisting of a few small muscle fibers with a capsule surrounding the middle third of the fibers. These fibers are called intrafusal fibers, in contrast to the ordinary extrafusal fibers. The ends of the intrafusal fibers are attached to extrafusal fibers, so whenever the muscle is stretched, the intrafusal fibers are also\n\nNotice how figure captions and sidenotes are shown in the outside margin (on the left or right, depending on whether the page is left or right). Also, figures are floated to the top/ bottom of the page. Wide content, like the table and Figure 3, intrude into the outside margins.', 'images': [], 'dimensions': {'dpi': 200, 'height': 1970, 'width': 1575}}, {'index': 3, 'markdown': '![img-2.jpeg](img-2.jpeg)\n\nFigure 3: Feedback loops for proprioceptive signals for the perception and control of limb movements. Arrows indicate excitatory connections; filled circles inhibitory connections.\n\nFor more examples of how to use HTML and CSS for paper-based publishing, see css4.pub.\nstretched. The central region of each intrafusal fiber has few myofilaments and is non-contractile, but it does have one or more sensory endings applied to it. When the muscle is stretched, the central part of the intrafusal fiber is stretched and each sensory ending fires impulses.\n\nMuscle spindles also receive a motor innervation. The large motor neurons that supply extrafusal muscle fibers are called alpha motor neurons, while the smaller ones supplying the contractile portions of intrafusal fibers are called gamma neurons. Gamma motor neurons can regulate the sensitivity of the muscle spindle so that this sensitivity can be maintained at any given muscle length.\n\n## Joint receptors\n\nThe joint receptors are low-threshold mechanoreceptors and have been divided into four groups. They signal different characteristics of joint function (position, movements, direction and speed of movements). The free receptors or type 4 joint receptors are nociceptors.', 'images': [{'id': 'img-2.jpeg', 'top_left_x': 155, 'top_left_y': 226, 'bottom_right_x': 1307, 'bottom_right_y': 843, 'image_base64': None}], 'dimensions': {'dpi': 200, 'height': 1970, 'width': 1575}}], 'model': 'mistral-ocr-2503-completion', 'usage_info': {'pages_processed': 4, 'doc_size_bytes': 145349}}
```

{% endcode %}

</details>

## Example #3: Process a PDF File And Parse the Response

As you can see above, the model returns markdown containing the recognized text with formatting elements preserved (headings, italics, bold text, etc.), along with the location of images within the text and the images themselves in base64 format, if you have enabled the corresponding option `include_image_base64`. However, the markdown is returned as a string with newline characters and other string attributes, so you might need to parse the output separately to get clean markdown containing only the formatted text and images. In this example, we’ve written code that make it for us.

<details>

<summary>Step-by-step example explanation</summary>

* **Send OCR request**\
  The `ocr_process()` function sends a POST request to the AIML API with the URL of a PDF document. It asks for OCR results including embedded base64 images.
* **Receive structured OCR output**\
  The API returns a JSON response containing extracted Markdown text and optional base64-encoded images for each page.
* **Create output directory**\
  The script creates an `output_images/` folder to store images extracted from the base64 data.
* **Replace image placeholders**\
  For each Markdown block, the script finds image placeholders like `![img-0.jpeg](img-0.jpeg)` and replaces them with local links to newly saved images.
* **Detect image format**\
  The script checks the base64 image header (`data:image/png;base64`, etc.) to determine whether to save the image as `.png` or `.jpg`.
* **Decode and save images**\
  The base64 image is decoded and saved to a file in the `output_images/` folder.
* **Combine Markdown**\
  All Markdown blocks from all pages are joined into a single `.md` file (`output.md`), separated by horizontal rules.
* **Done**\
  The final Markdown file includes properly linked images and is ready for use or preview.

</details>

{% code overflow="wrap" %}

```python
import os
import re
import base64
import requests

def ocr_process():
    response = requests.post(
        "https://api.aimlapi.com/v1/ocr",
        headers={
            "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
            "Content-Type": "application/json",
        },
        json={
            "document": {
                "type": "document_url",
                "document_url": "https://zovi0.github.io/public_misc/test-PDF-2.pdf"
            },
            "model": "mistral/mistral-ocr-latest",
            "include_image_base64": True,
            "image_limit": 5 
        },
    )

    data = response.json()
    print(data)
    
    return data

def parse_ocr_output(ocr_output):
    output_dir = "output_images"
    os.makedirs(output_dir, exist_ok=True)

    all_markdown = []

    for page in ocr_output.get("pages", []):
        md = page["markdown"]
        images = {img["id"]: img["image_base64"] for img in page.get("images", []) if img.get("image_base64")}

        def replace_image(match):
            image_id = match.group(1)
            base64_data = images.get(image_id)
            if not base64_data:
                return match.group(0)  # Leave original markdown if no image data

            # Detect image format
            img_match = re.match(r"data:image/(png|jpeg|jpg);base64,(.*)", base64_data)
            if not img_match:
                return match.group(0)

            img_format, img_b64 = img_match.groups()
            ext = "jpg" if img_format in ["jpeg", "jpg"] else "png"
            filename = f"{image_id}.{ext}"
            filepath = os.path.join(output_dir, filename)

            with open(filepath, "wb") as f:
                f.write(base64.b64decode(img_b64))

            return f"![{filename}]({filepath})"

        # Replace image links in markdown with local image links
        md = re.sub(r"!\[.*?\]\((img-\d+\.\w+)\)", replace_image, md)
        all_markdown.append(md)

    # Combine pages with spacing
    final_md = "\n\n---\n\n".join(all_markdown)

    with open("output.md", "w", encoding="utf-8") as f:
        f.write(final_md)

    print("Markdown and images saved.")
    return final_md

if __name__ == "__main__":
    ocr_output = ocr_process()
    parse_ocr_output(ocr_output)

```

{% endcode %}

<details>

<summary>Response before parsing</summary>

{% code overflow="wrap" %}

```json5
{'pages': [{'index': 0, 'markdown': '![img-0.jpeg](img-0.jpeg)\n\n# Characteristics of plant cells \n\nPlant cells have cell walls composed of cellulose, hemicelluloses, and pectin and constructed outside the cell membrane. Their composition contrasts with the cell walls of fungi, which are made of chitin, of bacteria, which are made of peptidoglycan and of archaea, which are made of pseudopeptidoglycan. In many cases lignin or suberin are secreted by the protoplast as secondary wall layers inside the primary cell wall. Cutin is secreted outside the primary cell wall and into the outer layers of the secondary cell wall of the epidermal cells of leaves, stems and other above-ground organs to form the plant cuticle. Cell walls perform many essential functions. They provide shape to form the tissue and organs of the plant, and play an important role in intercellular communication and plant-microbe interactions. ${ }^{[1]}$ The cell wall is flexible during growth and has small pores called plasmodesmata that allow the exchange of nutrients and hormones between cells. ${ }^{[2]}$', 'images': [{'id': 'img-0.jpeg', 'top_left_x': 198, 'top_left_y': 142, 'bottom_right_x': 405, 'bottom_right_y': 350, 'image_base64': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCADQAM8DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+iiigAooooAKKKM0AFFFFABRRR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gvRrPWJrr7XGXWILxnHWvQtO0TT9MG21tkTJzzyf1qt4a8MReH4XHnmeaTAZ9u0H8MnFb3lr9a6KVPlSub0qXKtVqJgDAIyaMc04AAUBa2NnpsJg04UUUMYUUuKKQCUUtFMBtOHSjFFACUZpaMUAf/2Q=='}], 'dimensions': {'dpi': 200, 'height': 2339, 'width': 1654}}], 'model': 'mistral-ocr-2503-completion', 'usage_info': {'pages_processed': 1, 'doc_size_bytes': 60230}}
```

{% endcode %}

</details>

<details>

<summary>Response after parsing</summary>

**Contents of the `output.md` file:**

{% code overflow="wrap" %}

```markdown
![img-0.jpeg.jpg](output_images\img-0.jpeg.jpg)

# Characteristics of plant cells 

Plant cells have cell walls composed of cellulose, hemicelluloses, and pectin and constructed outside the cell membrane. Their composition contrasts with the cell walls of fungi, which are made of chitin, of bacteria, which are made of peptidoglycan and of archaea, which are made of pseudopeptidoglycan. In many cases lignin or suberin are secreted by the protoplast as secondary wall layers inside the primary cell wall. Cutin is secreted outside the primary cell wall and into the outer layers of the secondary cell wall of the epidermal cells of leaves, stems and other above-ground organs to form the plant cuticle. Cell walls perform many essential functions. They provide shape to form the tissue and organs of the plant, and play an important role in intercellular communication and plant-microbe interactions. ${ }^{[1]}$ The cell wall is flexible during growth and has small pores called plasmodesmata that allow the exchange of nutrients and hormones between cells. ${ }^{[2]}$
```

{% endcode %}

**Content of `output_images` subfolder**

<figure><img src="https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-ea7338cb0207461687d50dcf7f4bc27eda78904b%2F%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png?alt=media" alt=""><figcaption></figcaption></figure>

**How it looks in any Markdown viewer:**

<figure><img src="https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-9fee6071a67716196bd27bd005695926bd52151e%2F%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5.png?alt=media" alt="" width="372"><figcaption></figcaption></figure>

It looks almost like the original PDF, but all the text has been recognized, and the markdown is easy to use further, for example, to embed in a web page. Enjoy!

</details>

[^1]: An integrated development environment (IDE) is a software application that helps programmers write, test, and debug software code efficiently.