Class WopiDocumentConverterAdapter

  • All Implemented Interfaces:
    org.imixs.workflow.Adapter, org.imixs.workflow.SignalAdapter

    public class WopiDocumentConverterAdapter
    extends Object
    implements org.imixs.workflow.SignalAdapter
    The WopiDocumentConverterAdapter can be used to convert office documents into PDF and other file formats. The Adapter simply calls a build in RestAPI of Collabora to convert documents based on the JODConverter (https://github.com/sbraconnier/jodconverter)

    There is no need to implement the libraries in case a Collabora instance is up and running. In this case the rest API endpoint 'lool/convert-to/' provides a convenience function. See details here: https://www.collaboraoffice.com/de/document-conversion/

    Documents can be converted into different formats by calling the corresponding endpoint.

    • https://localhost:9980/lool/convert-to/pdf for pdf
    • https://localhost:9980/lool/convert-to/png for png

    The rest service automatically detects the input document format.

    The adapter simply posts a given document to the service endpoint. The adapter can be configured by the event workflow result:

     
        <wopi-converter name=
    "api-endpoint">https://localhost:9980/lool/convert-to/</wopi-converter>
        <wopi-converter name="filename">......</wopi-converter>
        <wopi-converter name="convert-to">pdf</wopi-converter>
       
     

    The Collabora API endpoint must point to a collabora instance. The 'filename' is the file attached to the current workitem. This can also be a regular expression. The option 'convert-to' is optional and default value is 'pdf'

    Author:
    rsoika
    • Constructor Detail

      • WopiDocumentConverterAdapter

        public WopiDocumentConverterAdapter()
    • Method Detail

      • execute

        public org.imixs.workflow.ItemCollection execute​(org.imixs.workflow.ItemCollection document,
                                                         org.imixs.workflow.ItemCollection event)
                                                  throws org.imixs.workflow.exceptions.AdapterException,
                                                         org.imixs.workflow.exceptions.PluginException
        The execute method expects a 'wop-converter' configuraiton and a corresponding attachement. The method calls the Collabora Rest API to convert the file into PDF and attaches the new file.
        Specified by:
        execute in interface org.imixs.workflow.Adapter
        Throws:
        org.imixs.workflow.exceptions.AdapterException
        org.imixs.workflow.exceptions.PluginException