DOC to HTML
DOC to HTML was born in 2017 at Kelyon (opens in a new tab), where I worked as a Drupal developer. Clients sent us their privacy policies as Word files, to be published as HTML on 22 sites: the module converted them with LibreOffice and loaded them into the content field. Since then I have carried it all the way to Drupal 12. This page compares it with the other ways of getting a document into Drupal: the facts about the other tools come from their official pages, the opinion on which one fits is mine.
Who builds DOC to HTML, and since when
What DOC to HTML is built with
What problem DOC to HTML solves
Most sites get Word content in by copy and paste, and the result depends on whoever does it: Word styles leak into the field, images get lost, tables have to be rebuilt by hand. The original document stays in a shared folder, and the published page loses the link to its source.
How DOC to HTML solves the problem
A widget for long text fields that converts the document with LibreOffice installed on the server. The file never leaves the site's infrastructure during the conversion. The HTML comes back stripped of scripts and page styles, the images become files managed by Drupal, and the original document can be saved in a file field on the same node.
What DOC to HTML achieved
The project was created on Drupal.org on . The latest release is 2.1.0, dated . It is used by 3 sites (Drupal.org, as of ).
How to get a Word document into Drupal
There are five main options. They differ in where the conversion runs, which formats they read and what happens to the images.
| Tool | Where it converts | Formats | Images |
|---|---|---|---|
| Paste from Office, in core | in the browser | whatever you copy from Word | unreliable |
| CKEditor 5 Premium, Import from Word | CKSource cloud or your own server | DOCX, DOTX | inline in the text |
| Docx to HTML Convert tool | in the browser | DOCX | inline in the text |
| Mammoth | in the browser | DOCX | Drupal files |
| DOC to HTML | on the server, with LibreOffice | DOCX, DOC, ODT, RTF, PPTX | Drupal files |
Each option puts the text in a different place. Paste from Office and Import from Word work inside the editor. Docx to HTML Convert tool and Mammoth show the result on a separate page, and you copy it into the field yourself. DOC to HTML adds a widget under the field, in the content form.
Import from Word needs a commercial license; the others are free. Mammoth stops at Drupal 10, while DOC to HTML 2.1 starts at Drupal 11.2 and covers Drupal 12.
Four of the five keep the document on your own infrastructure; the CKSource cloud service is the exception. Privacy is rarely what decides it. Formats, images and server requirements are.
Paste from Office is on by default in every CKEditor 5 editor in Drupal, with nothing to configure. Images pasted together with the text are its weak spot: the CKEditor documentation warns that they sometimes arrive broken.
Developers have a few more options that convert from code and have no editor interface. Document Loader (opens in a new tab) and AI File to Text (opens in a new tab) read Word, ODT and RTF with the PHPWord library on the server, mostly to prepare text for AI tools. ODT Importer (opens in a new tab) reads ODT files only and fills a field chosen in its settings.
When DOC to HTML is the right choice
DOC to HTML fits when at least one of these is true:
- documents arrive in formats other than DOCX: DOC, ODT, RTF or PPTX slides;
- the conversion has to happen in the content form, on the field, without a detour through another page;
- the images in the document have to become files managed by Drupal;
- the original document has to stay attached to the node;
- conversions need to run from Drush, hooks or events;
- you control the server and can install LibreOffice on it.
When another tool fits better
- Shared hosting without LibreOffice: Docx to HTML Convert tool runs in the browser and works on any host with Drupal 10 or 11.
- DOCX only, a few at a time: Paste from Office is already in the editor, and for plain text it is enough.
- Word comments and tracked changes in the editor: that is what CKEditor 5 Premium is for, with a paid license.
- Drupal 10: the 2.0.x branch of DOC to HTML, from 2.0.2, runs on Drupal 10.3 and 11 and converts DOC and DOCX. Images as Drupal files and the ODT, RTF and PPTX formats arrive with 2.1.
What DOC to HTML needs on the server
Version 2.1 needs Drupal 11.2 or later, or Drupal 12, with PHP 8.3. The server needs LibreOffice and the PHP function proc_open. LibreOffice takes disk space, has to be updated like any other package, and starts a separate process for every conversion. Sites still on Drupal 10, 11.0 or 11.1 use the 2.0.x branch.
| Requirement | Version 2.1 |
|---|---|
| Drupal | 11.2 or later, 12 |
| PHP | 8.3 or later |
| LibreOffice | on the machine where PHP runs; tests use 7.4 and 25.2 |
| Drush | 13.7 or later, for the commands |
| Drupal 12 with summary fields | text_with_summary module |
How to install DOC to HTML
- Install LibreOffice on the server.
- Install and enable the module with Composer and Drush.
- Check the LibreOffice path at
/admin/config/content/doc_to_html/libreoffice-settings. Thedrush dth:versioncommand confirms that the module finds it. - In Manage form display for the content type, pick the DOC to HTML widget for the text field.
On Debian or Ubuntu, the LibreOffice packages without a graphical interface are enough:
apt install libreoffice-writer-nogui libreoffice-impress-noguiThe module installs and enables with two commands:
composer require drupal/doc_to_html
drush en doc_to_htmlThe step by step guide for the Article content type is in the module documentation (opens in a new tab).
Sources
- DOC to HTML project page (opens in a new tab), drupal.org. Checked on 4 October 2026, primary source.
- DOC to HTML documentation (opens in a new tab), including the comparison with the alternatives. Checked on 4 October 2026, primary source.
- CKEditor 5 Premium Features (opens in a new tab), drupal.org. Checked on 4 October 2026, primary source.
- Docx to HTML Convert tool (opens in a new tab), drupal.org. Checked on 4 October 2026, primary source.
- Mammoth (opens in a new tab), drupal.org. Checked on 4 October 2026, primary source.
- Paste from Office (opens in a new tab), CKEditor 5 documentation. Checked on 4 October 2026, primary source.
- Import from Word (opens in a new tab), CKEditor 5 documentation. Checked on 4 October 2026, primary source.
This text was translated by AI.
How was AI used?
Translated from the Italian original with AI assistance, then read and corrected by a person, who holds editorial responsibility.