« Plugin wishes for mac… | Home | MBS FileMaker Plugin,… »

Convert office documents to PDF with LibreOffice

See newer version here: Convert Office Files in FileMaker


Did you know you can use LibreOffice to convert your Word, Excel or Powerpoint documents to PDF files?

You can learn about command line commands in the help: Starting the LibreOffice Software With Parameters.

To show an example, let us convert a Word file to PDF:

/Applications/LibreOffice.app/Contents/MacOS/soffice --convert-to pdf --outdir /Users/cs/Desktop /Users/cs/Documents/test.doc

To run this, you can use Shell class in Xojo or Shell functions for FileMaker in MBS Plugin.

In FileMaker, you can run this with shell functions like this:

Set Variable [ $shell ; Value: MBS( "Shell.New" ) ]
Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; "/Applications/LibreOffice.app/Contents/MacOS/soffice"; "--convert-to"; "pdf"; "--outdir"; "/Users/cs/Desktop"; "/Users/cs/Documents/test.doc" ) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Failed to run" ; $s ]
Else
    Set Variable [ $s ; Value: MBS( "Shell.Wait"; $shell; 10) ]
    Set Variable [ $error ; Value: MBS( "Shell.ReadErrorText"; $shell; "UTF-8") ]
    Set Variable [ $result ; Value: MBS( "Shell.ReadOutputText"; $shell; "UTF-8") ]
    Show Custom Dialog [ "Converted" ; $result & ΒΆ & $error ]
End If
Set Variable [ $r ; Value: MBS("Shell.Release"; $shell) ]

Enjoy conversion! Claris FileMaker Plugin
15 06 18 - 22:02