This project is not covered by Drupal’s security advisory policy.

The Pandoc module integrates the Pandoc command-line tool into Drupal, providing a reusable service for converting documents (PDF, Word, ODT, Markdown, and
many other formats) to plain text or HTML.

Features

  • A pandoc Drupal service (PandocService) injectable into any custom module or service
  • Convert any Pandoc-supported input file to plain text or HTML output
  • Configurable path to the Pandoc binary via an admin settings page
  • Live status indicator on the settings page showing whether the binary is reachable and its version

Requirements

  • Drupal 10.2, 11, or 12
  • The Pandoc binary installed on the server (available via most Linux package managers, Homebrew on macOS, or as a standalone installer)

Installation

  1. Install the module as usual (Composer recommended: composer require drupal/pandoc).
  2. Enable the module: drush en pandoc.
  3. Go to Administration > Configuration > Pandoc settings and enter the path to the Pandoc binary (e.g. /usr/bin/pandoc). If Pandoc is on the system PATH, the default
    value pandoc is sufficient.

Usage

Inject the pandoc service into your own module and call convert():

  $text = \Drupal::service('pandoc')->convert('/path/to/document.docx', 'plain');
  $html = \Drupal::service('pandoc')->convert('/path/to/document.docx', 'html');
  

The second argument is any Pandoc output format string. It defaults to plain.

Supporting organizations: 
funding

Project information

  • caution Seeking co-maintainer(s)
    Maintainers are looking for help reviewing issues.
  • Project categories: Developer tools
  • Created by wouters_f on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases