Libreoffice online vs calling libreoffice headless

Hello, I have been searching a lot for the right way to use Libreoffice for the purpose of converting word documents to pdf documents from within a php application in windows server. What I found is the following:

  1. Simply call libreoffice headless from php “exec” command, for example
    soffice --headless --convert-to pdf abc.docx --outdir ./my_files … etc
  2. Using unoconv
    unoconv · PyPI
  3. Using Libreoffice online from Collaboraonline

I tried the first approach and it is working fine. So, I’m not sure why should I go with approach 2 or 3. What is the right approach to use? Is it just a matter of convenience? or there are concrete reasons behind which option to use (such as parallel requests, scalability, etc)
I read the information in the following page, but I really need more elaboration

The second part of my question, how can I use Libreoffice online from within php web application using apache server installed via xampp?

Thanks

I tried the first approach and it is working fine.
So, I’m not sure why should I go with approach 2 or 3.

Good question; there are lots of reasons; lets list a few:

  • security - COOL will isolate each document in a chroot, so something bad - a macro, or script, or exploit will not be able to escape and damage your machine or leak other document data
  • reliability / lifecycle management - sometimes libreoffice can hand on load, or hit some corner-case of throwing up a dialog that was un-anticipated. COOL will time such documents out after a configurable period and fail cleanly for you.
  • performance - and parallel processing. A local libreoffice process is single threaded, and will only process one request at a time. It is possible to work around this, and write extra code to manage a pool of processes - but it is a real pain, and like anything threaded - problematic to get right - COOL does that all already for you
  • memory efficiency - COOL works hard to share memory between parallel documents, it will be far cheaper than running multiple parallel libreoffice processes.
  • manage-ability with a very simple REST convert-to interface, you can easily deploy and manage docker containers for COOL and host those on a different machine - or behind a high availability / load balancer for larger setups. You can manage and see the cost of that workload by itself easily separated from the web workload.
  • support/SLA - ok so a gratuitous commercial plug - but some people really want that for their deployments so they can be confident in availability. Its there as an option with COOL.

Inevitably I’ll think of some more when I hit sent, but I hope that helps.

1 Like

Thanks for the reply, I will try to grasp all the ideas in your reply. However, may you answer the second part of my question which was:

how can I use Libreoffice online from within php web application using apache server installed via xampp?

Thanks again

You could check out the SDK page for examples.

1 Like