# Convert Office Files in FileMaker using LibreOffice and Shell functions in MBS Plugin

**URL:** <https://the.fmsoup.org/t/convert-office-files-in-filemaker-using-libreoffice-and-shell-functions-in-mbs-plugin/5755>\
**Category:** MBS Plugins\
**Tags:** pdf, plugin, mbs\
**Created:** [September 8, 2026, 8:58am UTC](https://the.fmsoup.org/t/convert-office-files-in-filemaker-using-libreoffice-and-shell-functions-in-mbs-plugin/5755 "2026-09-08T08:58:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [September 8, 2026, 8:58am UTC](https://the.fmsoup.org/t/convert-office-files-in-filemaker-using-libreoffice-and-shell-functions-in-mbs-plugin/5755/1 "2026-09-08T08:58:57Z")

</div>

## [Convert Office Files in FileMaker](https://www.mbsplugins.de/archive/2026-09-06/Convert_Office_Files_in_FileMa)

![](https://www.mbsplugins.de/images/libreoffice.jpg)

We have a few customers who use document databases to store Word, Excel, PowerPoint, and other documents in a FileMaker database. To preview these documents in a container field, we need to generate a preview image for each document. JPEG, PNG, and a few other image formats can be displayed directly. However, Office documents need to be converted into images, and this requires an application that can correctly handle document layouts, page breaks, and other formatting.

![](https://www.mbsplugins.de/images/CreateWordPDF.jpg)

That is where we use [LibreOffice](https://www.libreoffice.org/). It allows us to convert all the given file types:

We run in a problem when trying to use LibreOffice on macOS within a script running in FileMaker Server. The application crashed as it tried to initialize the GUI. I reported this as

[Bug 169711](https://bugs.documentfoundation.org/show_bug.cgi?id=169711): Crash on macOS when running LibreOffice headless via Terminal without GUI

This bug is fixed for the 26.8.0 version.

If you have that version copied to your macOS server, you can simply invoke LibreOffice with the [Shell](https://www.mbsplugins.eu/component_Shell.shtml) functions. Pass the **--convert-to** parameter with the desired type of **pdf**. We need the **--headless** parameter to avoid the GUI to initialize. e.g. you would use a call like this:

MBS( "Shell.Execute"; $shell; $appPath; "--convert-to"; "pdf"; "--headless"; "--outdir"; $OutputFolder; $InputFile )

The $appPath would be "/Applications/LibreOffice.app/Contents/MacOS/soffice" on macOS, "C:\Program Files\LibreOffice\program\soffice.exe" on Windows and "/usr/bin/soffice" on Linux.

You find the example script in the [PDFKit Print Documents.fmp12](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/PDFKit%20Print%20Documents.shtml) file.

There are a few special things in our example script. First we create a temp folder for both input and output using an UUID for each. This way we never have trouble with duplicate file names in those folders. And whatever file appears later in output file is our result. The use of UUIDs allow this to run in multiple scripts in parallel if needed. We use [Container.WriteFile](https://www.mbsplugins.eu/ContainerWriteFile.shtml) function to write the file into the input folder.

The [Shell.Execute](https://www.mbsplugins.eu/ShellExecute.shtml) call passes each parameter as a parameter to the plugin, so the quoting is done right internally. Then the whole thing runs in the background and we wait up to 10 seconds with [Shell.Wait](https://www.mbsplugins.eu/ShellWait.shtml) function. On return we read any error messages and then look for the PDF file in the output folder.

Finally we have to do some cleanup with deleting temp files. In case the process would crash, you may just not get the PDF.

Please try the sample file and the sample script to convert your office files to PDF. And do not hesitate to contact us if you have questions.
