🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Use LibreOffice for PDF Conversion
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

LibreOffice lets you convert MDriven-generated OpenDocument reports on the Turnkey server, for developers who need server-side PDF or Microsoft Office output.

What LibreOffice converts

MDriven reports are generated as OpenDocument files:

Report type Generated format LibreOffice conversion output
Text document .odt .pdf or .docx
Spreadsheet .ods .pdf or .xlsx

For example, a ViewModel can generate Invoice.odt from an OpenDocument template. LibreOffice can then convert that document to Invoice.pdf before the user downloads it.

Use this approach when the server running Turnkey needs to perform the conversion. Do not use Microsoft Word automation for this server-side scenario; see Documentation:PDF for the server-side considerations and other PDF conversion options.

Prerequisites

  • Install LibreOffice on the server that runs Turnkey.
  • Make the LibreOffice executable available to the account that runs the Turnkey application.
  • Configure the executable path in MDriven as described below.
  • Ensure that the documents you submit have the correct file extension. For example, set a text document name to Report.odt, not only Report.

LibreOffice is a separate product and is licensed separately from MDriven.

Install and configure LibreOffice

  1. Install LibreOffice on the Turnkey server.
  2. During installation or later in LibreOffice settings, disable online updates. A server may be restricted from accessing the internet; update checks in that environment can cause erratic behavior.
  3. Disable Java support to reduce the time LibreOffice takes to load for each document:
    1. Open LibreOffice Options with Alt + F12.
    2. In the sidebar, select LibreOffice, then select Advanced.
    3. Clear Use Java runtime environment.
    4. Select OK.
  4. Find the full path to the LibreOffice executable. A typical Windows installation path is C:\Program Files\LibreOffice\program\soffice.exe.
  5. In the MDriven model, set SysMDrivenMiscSettingsSingleton.LibreOfficeInstallPathAndExe to that complete executable path.

The path must point to soffice.exe, not only to the LibreOffice installation folder.

Convert documents through SysDocBatch

SysDocBatch is the MDriven document-batch pattern for collecting generated documents before download. It can convert and zip the collected documents. Keep the SysDocBatch and SysDoc classes transient, as described on the SysDocBatch page.

A typical report-to-PDF flow is:

  1. Create an .odt or .ods report from a ViewModel.
  2. Add the generated document to the current SysDocBatch instead of downloading it immediately.
  3. Open the SysDocBatchView modal view when the first SysDoc is added.
  4. In that view, choose the PDF conversion action for the document.
  5. Download the converted file, or collect multiple converted documents and create a ZIP download.

For example, an action that generates one invoice report per selected customer can add each generated .odt file to the same batch. The user can review the list in SysDocBatchView, convert the documents to PDF, and download the resulting collection.

The SysDoc conversion methods are:

SysDoc method Use
ConvertToPDFWithLibreOffice Converts an OpenDocument text report to PDF.
ConvertToMSOfficeWithLibreOffice Converts OpenDocument documents to Microsoft Office output.

Follow the full pattern setup and the independent document-converter workflow in Documentation:SysDocBatch. That page also describes how to upload a document through the SysDoc view, set DocName including its extension, convert it in SysDocBatchView, and create a ZIP download.

Generate the input report

LibreOffice converts the document after MDriven has generated it; it does not replace report generation. Create the OpenDocument template and the report ViewModel first.

For a text report, use an .odt template and set the generated report file name to an .odt name, such as Invoice.odt. For a spreadsheet report, use an .ods template and an .ods output name, such as SalesSummary.ods.

See Training:Microsoft office and OpenDocument as a Report generator for the complete template, ViewModel, tags, and report-action setup.

Diagnose a failed conversion

Each SysDoc stores information that helps you investigate a conversion failure:

SysDoc member What to check
DocName Confirm that the file name includes the expected source extension, such as .odt or .ods.
ConversionLog Review the message returned by LibreOffice during conversion.
InfoOnFailed Review the exception message when conversion fails.
DocData Confirm that the source document data was attached to the SysDoc.

If conversion fails, first verify the configured soffice.exe path, then verify that LibreOffice is installed on the same server that runs Turnkey and that the source document has the correct extension.

See also