Ask Your Question

How to convert doc to pdf using LO commandline

asked 2018-10-01 14:54:17 +0200

BinoyCherian gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-01 15:05:53 +0200

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

edit flag offensive delete link more


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 @Mike.

BinoyCherian gravatar imageBinoyCherian ( 2018-10-01 15:09:03 +0200 )edit

well - heh, I know the code ;-)

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

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-01 15:11:25 +0200 )edit

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

BinoyCherian gravatar imageBinoyCherian ( 2018-10-01 15:14:51 +0200 )edit

fixed in tdf#120249

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-01 22:51:58 +0200 )edit

Thanks @Mike, 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

BinoyCherian gravatar imageBinoyCherian ( 2019-02-04 14:08:26 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-01 14:54:17 +0200

Seen: 2,038 times

Last updated: Oct 01 '18