Soffice converts password protected file to PDF with junk characters

When I try to open a password protected doc file to pdf using sOffice.exe, it generates the pdf file but has juck characters in it. Is there a way instead to prevent it from creating PDF file altogether?

soffice.exe --headless --convert-to-pdf c:\docs\passwordprotected.docx --outdir d:\docs

Appreciate any help on this.

Seems there is no option for password protected files.

https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters

Related enhancement is tdf#42647.

Thanks for the reply.

But in that case soffice should not generate PDF at all. In this case it still generates the pdf file but has junk character in it. Is there a way to prevent it from generating at all.

Thanks @oweng, I don’t know but maybe the intention behind this behaviour is don’t make easy to discover the password.

There’s no way to recover the pw anyway, you have to try out everything through bruteforcing or lucky guesses, but no matter what recovery is impossible.

If there is a way to recover the password then the protection is not safe. The important is avoid that others can open your protected file. Is your responsability save your passwords, have a secure password protection it’s not a joke.