No available preparatory measure that I am aware of for detecting encryption state. Best bet is to try, and detect error condition.
In command line you use >
to redirect stdout
to a file, and 2>
redirects stderr
.
Append >log.txt 2>err.txt
to your command line in order to create a log file for the job and an error file showing the error message.
Something like:
soffice --headless --convert-to pdf D:\test.docx --outdir D:\output >D:\log.txt 2>D:err.txt
Alas, the error file will not show the file name, which makes it less useful if you use wildcards in your command to convert multiple files in one go. Workable for individual converts, but for batch job, subsequently checking for the existence of the result file is probably better. With large batches it may still make sense to create an error file and first check whether that exists. If no errors are output, job completed successfully. No need to confirm individual file’s existence.