Use local fonts for soffice.exe --headless on Windows

Hi, my Windows VM has no fonts installed and I can’t access C:\Windows\Fonts.

Can I get soffice.exe to use fonts in a custom folder? My command is:

soffice.exe --headless --convert-to pdf --outdir "D:\home\site\wwwroot" "D:\home\site\wwwroot\mydoc.docx"

This command is OK on my local machine but on the server it fails with:

No fonts could be found on the system.

I’m trying to convert docs to PDF on an Azure App Service, it’s a Windows VM with no fonts installed. Thanks!

Note that you should not use .exe in your command. Actually, to properly get the console output - e.g. in case of errors - you need to use soffice.com (available since LibreOffice 6.3, see this blog post); if you use usual BAT files, simply using soffice <switches...> <filenames...> - i.e. without explicit extension - uses .com automatically. Or you may use .com explicitly (e.g., when you use the command not from Cmd.exe, but from some other environment, which does not use PATHEXT environment variable).

Yes you can. It partially depends on the Windows version on the VM.

In any case, you may put fonts to share/fonts/truetype under LibreOffice’s installation directory (the directory does not exist initially, create it under pre-existing share). So it would look like this:

<Program Files (or another place where you installed LibreOffice)>
    LibreOffice
        ...
        program
        ...
        share
            ...
            fonts                <= create this
                truetype         <= create this
                    <font1.ttf>
                    <font2.otf>
                    ...

If you are using Windows 10, it allows installing fonts per-user.

Mike,
You are a genius!

For me, on Win10 with LO 7.1.2, the font folder was here:
C:\Program Files\LibreOffice\program\resource\common\fonts

I installed 2 fonts to check, and this worked with both!

(The emoji font is not working, but no emoji fonts will work for me. I have had so many problems with Win10 that I’m assuming this is just another Widows issue.)

@Ninpodeshi: program\resource\common\fonts is another directory for internal resources, e.g. for our local copy of OpenSymbol. It was added lately; it is not meant for user additions, but yes, it would work (but I’d still not recommend using it). My answer mentioned another path, that is directly intended for shared user data: share\fonts\truetype.

Ok, thank you for the correction. I’ll use that space next time.