Skip to main content

Format Conversion (LibreOffice)

Performance and Applicability Notice

Word-to-PDF conversion is executed by the LibreOffice engine and is a resource-intensive operation. Its performance is significantly affected by CPU, memory, disk IO, file size, and document complexity, and may fluctuate considerably.

To ensure service stability, when ldoc is deployed independently, it is recommended to keep the conversion concurrency within the number of physical CPU cores, leaving some headroom. A practical upper bound is the number of physical CPU cores minus 2. For example, on an 8-core (8C) server, the number of concurrent conversion tasks should not exceed 6 (8 - 2 = 6).

The actual concurrency limit should be determined after thorough stress testing and capacity evaluation based on your business document samples.

I. LibreOffice Deployment​

For detailed installation and configuration steps, refer to: How to Deploy LibreOffice Service

II. Enabling PDF Conversion Based on LibreOffice​

Under the environment section of the app service, add the following configuration and then restart the service:

app:
environment:
ENV_PDF_CONVERT_TYPE: "libreoffice" # Added: Enable LibreOffice PDF conversion
Configuration Location for ENV_HAP_INTRANET_CROSS_ENDPOINT

ENV_HAP_INTRANET_CROSS_ENDPOINT allows the file service to access the HAP microservice and is required only in the following scenarios:

ENV_HAP_INTRANET_CROSS_ENDPOINT: "192.168.0.10:8880"

For single-node Docker Compose with an independently deployed file service, add it under app.environment in /data/mingdao/script/docker-compose.yaml.

For Kubernetes cluster deployments, add it under data in the env-list ConfigMap in /data/mingdao/script/kubernetes/config.yaml.

Replace 192.168.0.10:8880 with the intranet address of the HAP microservice that is accessible to the file service.

Click to view the complete modification example for single-node Docker Compose
version: '3'

services:
app:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-hap:7.5.3
environment: &app-environment
ENV_ADDRESS_MAIN: "https://hap.domain.com"
ENV_APP_VERSION: "7.5.3"
ENV_API_TOKEN: "******"
ENV_PDF_CONVERT_TYPE: "libreoffice" # Added: Enable LibreOffice PDF conversion
ports:
- 8880:8880
volumes:
- ./volume/data/:/data/
- ../data:/data/mingdao/data

sc:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-sc:3.2.0
environment:
<<: *app-environment
volumes:
- ./volume/data/:/data/

command:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-command:node1018-python36

doc:
image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:2.0.0