Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

AI File to Text

146 sites Security covered Drupal 10–11 AI ecosystem
View on drupal.org

This module automatically extracts content from uploaded documents like Word, PDF, and spreadsheets, converting it into plain text, HTML, Markdown, or structured JSON. It runs entirely on your server using PHP and can be integrated with other Drupal AI modules for automated text extraction and AI agent functionality.

AI File to Text automatically extracts content from uploaded document files and converts them to plain text, HTML, Markdown, or structured JSON. Built on an extensible extractor architecture, it integrates with the Drupal AI module and Document Loader module — providing AI Automator plugins, AI Agent function calls, and a Document Loader plugin as three consumers that all flow through the same extraction pipeline. No external services, APIs, or server-side applications required. Everything runs in pure PHP on your server.

Features

  • 10 file extensions supported out of the box across 7 extractors: Word (.docx, .doc), OpenDocument (.odt), PDF (.pdf), Spreadsheets (.xlsx, .xls, .ods, .csv), Plain Text (.txt), and Markdown (.md).
  • 4 output formats: plain text, styled HTML, Markdown, or structured JSON.
  • HTML output preserves headings, bold, italic, underline, font sizes, colors, links, lists, and tables.
  • JSON output produces a structured DOM tree ({"tag": "p", "attributes": {...}, "children": [...]}) for non-tabular files, or an array of objects keyed by column headers for spreadsheets/CSV.
  • Document Loader plugin (document_loader:file) — enables any third-party code to load documents programmatically via the Document Loader API.
  • AI Automator plugins for text_long and string_long fields — upload a file and the text is extracted automatically on entity save.
  • AI Agent function call (file_to_text) — AI agents can read and process documents autonomously.
  • Extensible architecture — other modules can register new file-type extractors as tagged services without modifying this module.
  • Dynamic type registration — extractor types and output capabilities are automatically discovered and registered with the Document Loader plugin system.
  • Per-type output accuracy — when extractors have different output capabilities, plugin definitions are automatically split into capability groups so that getLoaderByType() returns accurate results (no false positives).
  • No external services, APIs, or server-side applications required.

Architecture

All consumers go through a single unified path:

Consumers (Automator / FunctionCall / Document Loader API)
  └─ FileDocumentLoader  (document_loader plugin)
       └─ FileExtractorManager  (routes by file extension)
            └─ Extractors  (auto-discovered tagged services)

Installation

For DDEV environments with Poppler support, add to .ddev/config.yaml:

webimage_extra_packages:
  - poppler-utils

Extending — Adding Custom Extractors

Other modules can add support for new file types by:
See the module's README.md for a full extractor implementation example.

Requirements

PHP libraries (installed automatically via Composer):

Optional system package for improved PDF extraction:

  • poppler-utils — When installed, the module uses pdftohtml for higher-quality PDF output with better table, link, and style detection. Falls back to smalot/pdfparser if not available.

Recommended modules

  • AI Agents — Enables AI agent workflows where agents can call file_to_text to read and process uploaded documents autonomously.
  • AI Context — Provides additional context to AI operations, useful when combining file extraction with other AI tasks.

Similar projects

  • AI Simple PDF to Text — Handles PDF files, converts to plain text only.
  • Unstructured — Supports a similar range of file types but requires an external Unstructured API server or a SaaS account.

Supporting this Module

Contributions, bug reports, and feature requests are welcome in the issue queue.

Community Documentation

Documentation, architecture details, and usage examples are included in the module's README.md file.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Feb 2026
Latest release
3 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.0 Stable 10–11 May 31, 2026
1.0.x-dev Dev 10–11 Feb 11, 2026