Transformation: Reference


After installing LibreOffice it is possible to do the transformations, provided that the "soffice" command is defined in the PATH of the environment variables. In other words, the transformation can be done if that command can be executed from any path.

This way, the transformation works by indicating the action transform with the parameter "-a", the input file, parameter "-i" and the output file, parameter "-o":

dynadocx -a transform -i document.docx -o document.pdf

The extension of the output document establishes the new format of the document.

If the "soffice" command is unavailable in the global path, it is required to specify its path in the option libreoffice_path in a JSON file:

{
  "config": {
    "transform": {
      "libreoffice_path": ""
    }
  }
}

The following is the complete set of key/values admitted:

key value
libreoffice_path Path to LibreOffice main exec.

Here follows examples for Windows:

{
  "config": {
    "transform": {
      "libreoffice_path": "C:\\Program Files\\LibreOffice\\program\\soffice.exe"
    }
  }
}

for Linux:

{
  "config": {
    "transform": {
      "libreoffice_path": "/opt/libreoffice/program/soffice"
    }
  }
}

...and for macOS:

{
  "config": {
    "transform": {
      "libreoffice_path": "/Applications/Libreoffice.app/program/soffice"
    }
  }
}

When indicating the path to LibreOffice, transformation is done with a reference to the matching JSON with the parameter "-d":

dynadocx -d data.json -i document.docx -o document.pdf

Document transformation only works with documents that exist in the filesystem, not with URLs.

Document transformation admits a single file as input and another one as output, but not multiple values.

Icon