docling icon indicating copy to clipboard operation
docling copied to clipboard

OCR in .docx not Working

Open DraculaVladimir opened this issue 1 year ago • 3 comments

Bug

No OCR is working for images inside of a .docx. When i export that docx as a pdf, then it works. ...

Steps to reproduce

Here is a random picture placed inside a .docx and a .pdf file. I create the .pdf using word file > save as > pdf.

Example Files: Doc1.pdf Doc1.docx

Instalation:

version: "3.8"

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:dev-cuda
    container_name: open-webui
    restart: always
    ports:
      - "3000:8080"
    volumes:
      - open-webui:/app/backend/data
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      DEVICE_TYPE: "cuda"
      AUDIO_TTS_OPENAI_API_KEY: "ShrekIsmylover"
      AUDIO_TTS_ENGINE: "openai"
      AUDIO_TTS_OPENAI_API_BASE_URL: "http://host.docker.internal:5050"
      CONTENT_EXTRACTION_ENGINE: "docling"
      DOCLING_OCR_LANG: "eng,por"
      DOCLING_OCR_ENGINE: "tesseract"
      WEBUI_SECRET_KEY: "Damn9D4niel8Cake7Love34"
      DOCLING_SERVER_URL: "http://host.docker.internal:5001"
    gpus: all

  openai-edge-tts:
    image: travisvn/openai-edge-tts:latest
    container_name: openai-edge-tts
    labels:
      group: OpenWebUi
    ports:
      - "5050:5050"
    environment:
      API_KEY: "ShrekIsmylover"
      PORT: "5050"
      DEFAULT_VOICE: "en-US-AndrewMultilingualNeural"
      DEFAULT_RESPONSE_FORMAT: "mp3"
      DEFAULT_SPEED: "1.0"
      DEFAULT_LANGUAGE: "en-US"
      REQUIRE_API_KEY: "True"
      REMOVE_FILTER: "False"
      EXPAND_API: "True"

  docling:
    image: quay.io/docling-project/docling-serve-cu124
    container_name: docling
    labels:
      group: OpenWebUi
    ports:
      - "5001:5001"
    environment:
      DOCLING_SERVE_ENABLE_REMOTE_SERVICES: "true"
      DOCLING_SERVE_ENABLE_UI: "true"
      DOCLING_SERVE_ARTIFACTS_PATH: "/modelcache"
      DOCLING_SERVE_DEFAULT_DO_OCR: "true"
      DOCLING_SERVE_DEFAULT_FORCE_OCR: "true"
      DOCLING_SERVE_DEFAULT_FORCE_FULL_PAGE_OCR: "true"
      DOCLING_SERVE_DEFAULT_OCR_ENGINE: "tesseract"
      DOCLING_SERVE_DEFAULT_OCR_LANG: "eng,por"
   
    volumes:
      - docling-model-cache:/modelcache
    deploy:                        
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]

volumes:
  open-webui:
    external: true
    name: open-webui


  docling-model-cache:

Then docker exec -it -u 0 docling bash

Then docling-tools models download --output-dir /modelcache --all ...

Docling version

((app-root) ) bash-5.1# docling --version
Docling version: 2.38.0
Docling Core version: 2.38.1
Docling IBM Models version: 3.6.0
Docling Parse version: 4.1.0
Python: cpython-312 (3.12.10)
Platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.34

...

Python version

((app-root) ) bash-5.1# python --version
Python 3.12.10

...

DraculaVladimir avatar Jul 02 '25 03:07 DraculaVladimir

OCR is not currently performed on images inside .docx files in Docling. This is a limitation of the current architecture: while images are extracted from .docx files, there is no step in the pipeline that runs OCR on those images, even if OCR is enabled in your configuration. In contrast, the PDF pipeline explicitly includes an OCR step for images, which is why it works when you export your .docx as a PDF first see code details.

There are no configuration flags or environment variables that enable OCR for images in .docx files in current Docling versions confirmation. This isn’t a regression or a bug in your setup—just a missing feature.

For now, your best workaround is to continue exporting .docx files as PDFs before processing, or manually extract images from .docx files and run OCR on them outside Docling. If OCR on images in .docx files is important for your workflow, you may want to keep an eye on future releases for this capability.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about docling with Dosu Add Dosu to your team

dosubot[bot] avatar Jul 02 '25 03:07 dosubot[bot]

Hi @DraculaVladimir, dosubot suggested an answer above but there's been no confirmation either way. Did that resolve it for you, or should this stay open? If we don't hear back within a week, we'll close it. Feel free to reopen if you see a need.

cau-git avatar Sep 01 '26 14:09 cau-git

Closing this issue because we did not hear back after our check-in on September 1. If it is still relevant for you, please reopen it or open a new issue with a current Docling version and a reproducer. Thanks!

cau-git avatar Oct 14 '26 13:10 cau-git