Forum


Replies: 1   Views: 39
Converting to pdf with libreoffice uses 100% of the cpu

Posted by Teresa Alvarez  · 07-11-2025 - 19:31

I've noticed that when converting to PDF using LibreOffice, the CPU usage is always 100%. Looking at the `TransformDocAdvLibreOffice` class, I see that it uses invisible mode by default, but some online sources recommend running LibreOffice in headless mode.

However, they also recommend using LibreOffice as a service listening on a port, for example:

`soffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;" --nofirststartwizard`

However, your documentation only mentions this for OpenOffice. Based on your experience, what is the best LibreOffice configuration for converting to PDF, or do you recommend using DOMPDF?

I'm using Phpdocx 15, and I create the documents through a Laravel job. Several users can create a document, and most of the time it's quite long, at least 100 pages. Converting to PDF using LibreOffice is becoming a bottleneck, and services are slowing down (web server, PHP, etc.).

Note: I'm not using concurrent conversion; I'm not clear on how to implement it.

Thank you for your attention.

Posted by admin  · 07-11-2025 - 20:05

Hello,

There are no performance differences between using invisible or headless options. The performance of LibreOffice is directly related to the performance of the server. We recommend using an SSD disk and a good CPU to get the best performance. Also, please note that complex documents will need more time to be transformed than simple documents.

The native mode is useful when the DOCX contains supported content and styles (https://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion).

On https://www.phpdocx.com/documentation/conversion-plugin/common-problems-and-possible-errors is detailed how to use concurrent conversions.

For further support about this same question, please write an email to contact[at]phpdocx.com. Also, please note the support included in licenses as detailed on https://www.phpdocx.com/support. Your license was purchased more than a year and a half ago, and it doesn't include active LUS, so support is limited to general questions and doubts. We recommend you upgrade to phpdocx 17 and include LUS to use all the new features from phpdocx (https://www.phpdocx.com/news/) and get technical support.

Regards.