Can`t update TOC, convert to pdf and get Java logs

Hello,
It would be great if you help me with several momets.
Unfortunately, I cannot provide the content that I will talk about. They don’t even provide it to me.

We use LibreOffice to update TOC in .docx files and export to .pdf.
There is a test set of files, more than five thousand. However, for some files(only two) the TOС is not updated and export to PDF does not occur after any timeout has expired.
Moreover, I can’t understand what the problem is, since I don’t receive any logs from LibreOfiice except on in Java logs: “convert /.docx as a Writer documrnt → /.pdf using filter:writer_pdf_Export”.
But as I`ve said it hangs and process destroy after timeout.

Macro:

sub UpdateTOC(sDocUrl as String)
dim oDocument as object
if fileExists(sDocUrl) then
Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
FileProperties(0).Name = "Hidden"
FileProperties(0).Value = True
oDocument = starDesktop.loadComponentFromUrl(convertToUrl(sDocUrl), "_blank", 0, FileProperties())

For iIndex = 0 To oDocument.DocumentIndexes.getCount() - 1
	oDocument.DocumentIndexes.getByIndex(iIndex).refresh()
Next iIndex

oDocument.store()
oDocument.close(true)

StarDesktop.terminate()

end If
end sub

Commands:
init:
**/soffice" -env:UserInstallation=file:///*/libreOfficeUserConfig --headless --terminate_after_init

export:
/soffice" -env:UserInstallation=file:///*/libreOfficeUserConfig --invisible --nofirststartwizard --norestore --nolockcheck macro:///standard.module1.UpdateTOC("\output.docx")
then
**/soffice" --convert-to pdf **/output.docx --outdir **\dir

Java code:

method() {
process.start()
getProcessLogs(
executorService.submit(log(getInputStream)
executorService.submit(log(getErrorStream)
)
try {
boolean good = process.waitFor(int, TimeUnit)
if (!good) {
log()
process.destroy()
}
} catch (e) {
log()
} finally {
process.destroy()
executorService.shutdown()
}
}

How can I get logs from LibreOffice to see what happens during process execution?
during update TOC
during convert to .pdf

++++++++++++++++++++++++++
Info:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
OS: Unix

Thanks,

out of curiosity, which one(s) ?

and maybe try to debug without “–headless”

Oh, sorry - CentOS Linux.

“–headless” is used only on start application command:
**/soffice" -env:UserInstallation=file:///*/libreOfficeUserConfig --headless --terminate_after_init and that`s it.
Ones it is completed, we use macro for future export to update TOC in docs.

5998 files - ok. 2 - no TOC update, no convert to pdf, process hangs.

sure. but then, without, you’ll have the LO window showing up;
and running on your 2 buggy files, maybe some error popping up or an indication of the problem … (ToC corrupted or similar …)

1 Like

Unfortunately, nothing. Nothing happens and no TOC in 2 .docx files. And still process hangs when converting to .pdf.