Speed up RTF to PDF (headless) conversions

We are using the soffice --headless --convert-to command to convert RTF documents to PDF.
The conversion accuracy is quite good, but we are trying to improve the speed of the conversion.
Ideas?

The initial conversion is about 5-10 seconds.
If we process a second document (all RTFs about the same), it is less than a second.
If we then wait a couple minutes and process a third document, it goes back to the 5-10 seconds...

We are calling this command from a java-based web application.
The conversions are done when someone loads a case/record that has associated RTFs (which we then process into PDF).
We are trying to reduce the lag between viewing the case and the availability of the PDF...

Thank you,

Brian

​To me, it sounds like libreoffice just shut down when it have nothing to
do, and so needs to start up again.

Depending on the way you do this, you could fiddle with the --accept option
to keep LibreOffice listening, or pre-start it with --invisible, keeping it
open.

The --invisible flag did not work.
It opens LibreOffice (can be seen in the Dock (Mac)).
But when I use the soffice command, it does not perform the conversion.
(We get the same behavior if we open LibreOffice from the gui and then run the command)

I was able to use some examples I found to get --accept running, but I don’t know what to do next...
/Applications/LibreOffice.app/Contents/MacOS/soffice "--accept=socket,host=127.0.0.1,port=2003,tcpNoDelay=1;urp;" --headless --nodefault --nofirststartwizard --nolockcheck --nologo --norestore
I see LibreOffice in the Dock, and I can telnet to localhost 2003...
/Applications/LibreOffice.app/Contents/MacOS/soffice --convert-to pdf /Users/itsme/Desktop/testOpNote1.rtf produces a brief 2nd LibreOffice in the Dock, but no PDF is created...

What command should I use once LibreOffice is running to get the convert-to flag to function (it only seems to work if LibreOffice is NOT running)?

Thank you,

Brian

If the QuickStarter is available for Mac, perhaps that would make a
difference.

Hi Bruce,

If the QuickStarter is available for Mac, perhaps that would make a
difference.

There is no LO quickstarter for Mac.

Alex

Hi Brian,

These pages might help you out :

http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.html

https://ask.libreoffice.org/en/question/12084/how-to-convert-documents-to-pdf-on-osx/

https://ask.libreoffice.org/en/question/2641/convert-to-command-line-parameter/

https://ask.libreoffice.org/en/question/1686/how-to-not-connect-to-a-running-instance/

http://stackoverflow.com/questions/22062973/libreoffice-convert-to-not-working

http://stackoverflow.com/questions/19280101/use-libreoffice-to-convert-html-to-pdf-from-mac-command-in-terminal

However, it doesn't seem to be immediately obvious.

Alex

Thank you Alex and Bruce.
The document describing how to use -env was particularly interesting...

Brian

Hi :slight_smile:
Annoyingly PDF is another non-standards based file-format.

In much the same way as RTF, DocX it does keep changing at the whim of a
single profit-making company - usually this keeps their own product ahead
of all competitors products in terms of writing and also in reading that
format. With PDF it's Adobe's whims that keep changing the format and
constantly making it different from other implementations, including their
own.

So people are kinda forced into using Adobe's PDF reader and need to keep
updating or upgrading it - or just accept that whichever pdf-reader they
currently use may not handle all Pdfs. When people use Adobe's newer
PDF-writer the resulting Pdfs may be unreadable (or have large chunks that
are unreadable/usable) in anything other than the latest Adobe Pdf-reader
Non-Adobe PDF-writers continue to write versions of Pdf that can be read by
almost any Pdf-reader.

Use of Pdf has risen 'recently' due to an increasing lack of confidence in
documents created in MS Word. People are finding that even old documents
may not be read perfectly in newer versions of MS Word than they were
written with, or even the 'same' version on a different machine.

The Pdf format generally removes the ability to edit or modify documents so
any documents kept only in that format will need to be completely
re-written for even fairly minor edits to bring them up-to-date. Some
very minor edits may be possible thanks to programs such as LibreOffice but
such programs rarely allow text to re-flow nicely in the way people usually
expect of word-processors such as Writer, Word, etc.

Regards from
Tom :slight_smile:

Hi :slight_smile:
Sorry for the appalling grammar in that excessively long post! Hopefully
people can get the gist of what i was trying to say.

Also i think the priorities should be re-arranged.

1. Using LibreOffice to convert files into Pdfs kinda ensures that ALL
different Pdf-readers are likely to be able to read the documents easily.

2. Although Rtf was inconsistent in implementation, in much the same way
that DocX has been so far (at least 4 different "transitional" versions so
far), the LibreOffice filters may well be one of the best at importing all
the various different implementations.

In each case it seems the creator of the format makes bold claims of
"interoperability" which they themselves then seem unable to fulfil - but
that everyone else seems to achieve by always having to "play catch-up".

I've not got definitive proof of any of these theories but it's just a
feeling i've built-up over the years from rumour&gossip in forums and from
people around me.

Regards from
Tom :slight_smile: