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,