Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

EML Previewer



This module needs external softwares to work correctly: The step-by-step instructions are specific to Linux based OS (Ubuntu in particular). It is probably possible to have the same software in Windows or other OS, but it hasn't been tested.


This modules allows you to preview .eml files (with mimetype as message/rfc822).


Upload an eml file in Web UI: It generates a PDF conversion, displayed within the Nuxeo PDF viewer.

ℹ️ The original EML file is not deleted or updated (still stored in file:content): The module only displays another blob property corresponding to the PDF conversion.



  1. Install xvfb (X server with virtual framebuffer i.e. headless)

sudo apt-get install xvfb

  1. Install wkhtmltopdf (requires an X server e.g. xvfb)

sudo apt-get install wkhtmltopdf

  1. Create script to run wkhtmltopdf with xvfb
  • Create the /usr/local/bin/wkhtmltopdf file (create the missing directories if needed)
xvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*
  • sudo chmod +x /usr/local/bin/wkhtmltopdf
  1. Install emailconverter
  • cd /usr/local/bin/
  • wget ""
  • chmod 755 emailconverter-2.0.1-all.jar
  1. Create a script to call emailconverter
  • Create the /usr/local/bin/ file with:
#!/bin/sh -x

  echo "LOG = '${LOG}'" | tee -a "${LOG}"

  echo "PWD = '${PWD}'" | tee -a "${LOG}"
  PWD=`realpath "${PWD}"`
  echo "PWD = '${PWD}'" | tee -a "${LOG}"

  BIN=`realpath "$0"`
  echo "BIN = '${BIN}'" | tee -a "${LOG}"

  DIR=`dirname "${BIN}"`
  echo "DIR = '${DIR}'" | tee -a "${LOG}"

  echo "JAR = '${JAR}'" | tee -a "${LOG}"

  echo "SOURCE = '${SOURCE}'" | tee -a "${LOG}"
  ls -l "${SOURCE}" | tee -a "${LOG}"

  echo "TARGET = '${TARGET}'" | tee -a "${LOG}"
  ls -l "${TARGET}" | tee -a "${LOG}"

  java -jar "${JAR}" -o "${TARGET}" "${SOURCE}" | tee -a "${LOG}"

  ls -l "${SOURCE}" | tee -a "${LOG}"
  ls -l "${TARGET}" | tee -a "${LOG}"
  1. Reload your PATH or reboot your server to load the new libraries.

Studio Modeler

  • Create a blob property on the document type storing the eml file. For this example, we've created a new property on the default File document type, called pdfconversion, of type blob
    • Consequently, its XPATH is file_schema:pdfconversion
  • Create the converter with a XML Contrib with the content of the EML_TO_PDF.xml file.
  • Create an automation scripting with the content of eml_to_pdf.js file. It accepts document and provide a document.
  • Create an event handler:
    • On Document Created or Imported
    • On the File Document Type
    • With custom EL Expression : Document['file:content/mime-type'] == "message/rfc822"

Studio Designer

  • Open the File view layout (UI/document/file/nuxeo-file-view-layout.hml)
  • Substitute the line <nuxeo-document-viewer role="widget" document="[[document]]"></nuxeo-document-viewer> with
    <template is="dom-if" if="[[_isEmail(document)]]">
    <nuxeo-pdf-viewer style="height:600px" src="[[_url(document)]]"/>

    <template is="dom-if" if="[[!_isEmail(document)]]">
    <nuxeo-document-viewer role="widget" document="[[document]]"></nuxeo-document-viewer>
  • Create the following methods in the Polymer section
_isEmail: function (document) {
      if (!document || ! {
        return undefined;
      var extension =["file:content"]["mime-type"];
      if (extension === 'message/rfc822') {
        return true;
      } else {
        return false
    _url: function(){
      var baseUrl = this.$.nxcon.url;
      var id = this.get("document.uid");

      return baseUrl + '/nxfile/default/' + id + '/file_schema:pdfconversion';


You can adapt this module:

  • Create a new document rendition instead of storing the conversion in a blob property
  • Execute the conversion on demand (from a button)
  • ...

Documentation Links

You can’t perform that action at this time.