How to convert doc to pdf using LO commandline

The string that I’m using to convert the documents is as below. I’m not sure if it’s a problem with the parameters passed to soffice.

soffice --convert-to pdf --outdir C:\test\NPP\LOTestOutputs\ C:\test\NPP\MBI_CONVERSION_PRESETS.docx

Also tried:

soffice --convert-to pdf C:\test\NPP\MBI_CONVERSION_PRESETS.docx --outdir C:\test\NPP\LOTestOutputs\

I was able to execute a simpler command [soffice --convert-to pdf MBI_CONVERSION_PRESETS.docx] from the cmd prompt

I referred to a similar problem on Stackoverflow And I checked that my user account has administrator rights. And I am not sure why I cannot convert the document using libreoffice.

The libreoffice version : 5.4

The error read from the stream

{Error: Please verify input parameters... (SfxBaseModel::impl_store <C:\test\NPP\LOTestOutputs" -env:OOO_CWD=2C:\\Users\\dev\\source\\repos\\Converstion\\TestClass\\bin\\Debug/MBI_CONVERSION_PRESETS.pdf> failed: 0x81a)}

Hoping to get some tips to understand why the program gives this error

Please don’t use the trailing backslash in the directory name (--outdir C:\test\NPP\LOTestOutputs\ should become --outdir C:\test\NPP\LOTestOutputs).

I have been searching over the internet to understand -env:OOO_CWD , failed: 0x81a and SfxBaseModel::impl_store. But the trailing backslash was the main problem. How did you identify this @Mike2.

well - heh, I know the code :wink:

by the way - there’s a bug you discovered (which is hanging soffice.bin in case of the command with trailing backslash) - thank you!

ahhaa np, I would also love to contribute via coding someday. @Mike2

fixed in tdf#120249

Thanks @Mike2, I had a question I am configuring the libreoffice on the server and I could manually convert the docx to pdf using the soffice command, but I’m having problem with the c# code which calls the soffice and passes the argument. I can’t seem to isolate the problem. I did a fresh install of the latest version of libreoffice

We’ve been using the TotalDocConverter for a few years and just purchased the upgrade to X. It has been working very well for us and we are very satisfied with the product. We use it to convert our documents to PDF format. I will need to look through the documentation to see if there is anything else we could utilize it for. It is product of coolutils.

Well, look at you, spamming this site with an ad for your product! Aren’t you clever?!