Error converting simple pptx file to pdf
Hi there,
When I attempt to convert a simple pptx file to pdf using the POST forms/libreoffice/convert endpoint in gotenberg I get a 500 error.
The pptx file that I am attempting to convert to pdf using the libre office engine is very simple. It has one slide with two images and a text label.
I think the issue is related to the images used in the pptx but I'm not sure why they would cause the pdf conversion to fail. When I remove one of the images from the pptx the pdf conversion runs successfully.
See the below screen grab of the erroneous slide in the pptx. I have also attached the pptx that is causing the conversion failure
The following is a snippet of debug logs central to the issue. Full logs are here
{"level":"debug","ts":1654172407.363404,"logger":"api.formslibreofficeconvert.usrliblibreofficeprogramsoffice.bin","msg":"unix process already killed","trace":"656a0796-af74-4b8c-9acd-456409a7fff5"}
{"level":"error","ts":1654172407.3656774,"logger":"api","msg":"convert to PDF: unoconv PDF: unix process error: wait for unix process: exit status 6","trace":"6922e459-19b5-41e2-aff1-ab95297d3c4d","remote_ip":"10.1.18.135","host":"gotenberg-service:3000","uri":"/forms/libreoffice/convert","method":"POST","path":"/forms/libreoffice/convert","referer":"","user_agent":"Apache-HttpClient/4.5.13 (Java/11.0.10)","status":500,"latency":14209214897,"latency_human":"14.209214897s","bytes_in":775610,"bytes_out":21}
{"level":"debug","ts":1654172407.3685727,"logger":"api.formslibreofficeconvert.usrliblibreofficeprogramsoffice.bin","msg":"start unix process: /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore -env:UserInstallation=file:///tmp/bd7353dc-0119-4d19-aa82-308b96069ef8 --accept=socket,host=127.0.0.1,port=41679,tcpNoDelay=1;urp;StarOffice.ComponentContext","trace":"6922e459-19b5-41e2-aff1-ab95297d3c4d"}
{"level":"debug","ts":1654172409.1584835,"logger":"api.formslibreofficeconvert.usrliblibreofficeprogramsoffice.bin","msg":"unix process already killed","trace":"6922e459-19b5-41e2-aff1-ab95297d3c4d"}
{"level":"debug","ts":1654172409.1585321,"logger":"api.formslibreofficeconvert","msg":"got exit code 81, e.g., LibreOffice listener first start","trace":"6922e459-19b5-41e2-aff1-ab95297d3c4d"}
Docker file used to build Gotenberg image
FROM gotenberg/gotenberg:7.5.2
USER root
COPY /resources/fonts/* /usr/local/share/fonts/
USER gotenberg
CMD ["gotenberg", "--pdfengines-engines=uno-pdfengine", "--api-disable-health-check-logging=true", "--log-level=debug", "--api-timeout=60s"]
Any help with this would be much appreciated!
Thanks, Keith
Hello @keithcaff,
LibreOffice may struggle with some files, usually for unknown reasons alas.
That being said, Gotenberg 7.5.2 is known to host an unstable version of LibreOffice. You may have more success with the version 7.4.3 😄
Hi @gulien,
Thanks for your reply. Unfortunately with version 7.4.3 I'm still getting a 500 error.
The following are the debug logs I am now seeing
-------------------------------------------------------
[SYSTEM] modules: api chromium gc libreoffice logging pdfcpu pdfengines pdftk prometheus qpdf unoconv unoconv-pdfengine webhook
[SYSTEM] prometheus: collecting metrics
[SYSTEM] api: server listening on port 3000
[SYSTEM] gc: application started
{"level":"debug","ts":1654248843.2161143,"logger":"unoconv.usrbinunoconv","msg":"start unix process: /usr/bin/unoconv --listener --user-profile ///tmp/766bd52b-ae57-4277-a73c-7e5b8f12b6e3 --port 34909 -vvv"}
[SYSTEM] pdfengines: unoconv-pdfengine
[SYSTEM] unoconv: listener started on port 34909
{"level":"debug","ts":1654248843.4895248,"logger":"unoconv.usrbinunoconv.stderr","msg":"Verbosity set to level 3"}
{"level":"debug","ts":1654248920.6886685,"logger":"api.formslibreofficeconvert","msg":"form data values: map[]","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.6894274,"logger":"api.formslibreofficeconvert","msg":"form data files: map[8a4c45b2-afa7-41e2-a053-351ade53d5cd.pptx:/tmp/d93bb79d-71db-4c56-99bd-051ce5805283/8a4c45b2-afa7-41e2-a053-351ade53d5cd.pptx]","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.690464,"logger":"api.formslibreofficeconvert","msg":"unoconv lock acquired","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.691568,"logger":"api.formslibreofficeconvert","msg":"print to PDF with: {Landscape:false PageRanges: PDFArchive:false}","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.6917465,"logger":"api.formslibreofficeconvert.usrbinunoconv","msg":"start unix process: /usr/bin/unoconv --format pdf --port 34909 -vvv --output /tmp/d93bb79d-71db-4c56-99bd-051ce5805283/5bef1829-bf89-405a-9bcf-df5b6e079445.pdf /tmp/d93bb79d-71db-4c56-99bd-051ce5805283/8a4c45b2-afa7-41e2-a053-351ade53d5cd.pptx","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.8108542,"logger":"api.formslibreofficeconvert.usrbinunoconv.stderr","msg":"Verbosity set to level 3","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.8127246,"logger":"api.formslibreofficeconvert.usrbinunoconv.stderr","msg":"DEBUG: Connection type: socket,host=127.0.0.1,port=34909,tcpNoDelay=1;urp;StarOffice.ComponentContext","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248920.9760728,"logger":"api.formslibreofficeconvert.usrbinunoconv.stderr","msg":"Input file: /tmp/d93bb79d-71db-4c56-99bd-051ce5805283/8a4c45b2-afa7-41e2-a053-351ade53d5cd.pptx","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248935.7764158,"logger":"unoconv.usrbinunoconv.stdout","msg":"Using office base path: /usr/lib/libreoffice"}
{"level":"debug","ts":1654248935.8413193,"logger":"unoconv.usrbinunoconv.stdout","msg":"Using office binary path: /usr/lib/libreoffice/program"}
{"level":"debug","ts":1654248935.8413668,"logger":"unoconv.usrbinunoconv.stdout","msg":"Start listener on 127.0.0.1:34909"}
{"level":"debug","ts":1654248935.841392,"logger":"unoconv.usrbinunoconv.stdout","msg":"Restarting LibreOffice (first start - 81 exit code)"}
{"level":"debug","ts":1654248936.4876368,"logger":"api.formslibreofficeconvert.usrbinunoconv.stderr","msg":"unoconv: RuntimeException during import phase:","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.487844,"logger":"api.formslibreofficeconvert.usrbinunoconv.stderr","msg":"Office probably died. Binary URP bridge disposed during call ./binaryurp/source/bridge.cxx:613","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.488449,"logger":"api.formslibreofficeconvert.usrbinunoconv.stdout","msg":"Using office base path: /usr/lib/libreoffice","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.4888082,"logger":"api.formslibreofficeconvert.usrbinunoconv.stdout","msg":"Using office binary path: /usr/lib/libreoffice/program","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.6989663,"logger":"api.formslibreofficeconvert.usrbinunoconv","msg":"unix process already killed","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.7014818,"logger":"api.formslibreofficeconvert","msg":"unoconv lock released","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"debug","ts":1654248936.7059922,"logger":"api.formslibreofficeconvert","msg":"'/tmp/d93bb79d-71db-4c56-99bd-051ce5805283' removed","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa"}
{"level":"error","ts":1654248936.7155395,"logger":"api","msg":"convert to PDF: unoconv PDF: unix process error: exit status 6","trace":"7584b0fa-fbbe-4df6-8b1c-7341d5a01efa","remote_ip":"10.1.18.135","host":"gotenberg-service:3000","uri":"/forms/libreoffice/convert","method":"POST","path":"/forms/libreoffice/convert","referer":"","user_agent":"Apache-HttpClient/4.5.13 (Java/11.0.10)","status":500,"latency":16033351171,"latency_human":"16.033351171s","bytes_in":775608,"bytes_out":21}
{"level":"debug","ts":1654249205.218242,"logger":"gc","msg":"'/tmp/OSL_PIPE_1001_SingleOfficeIPC_5d5fd1854aa05ac155dfddba328619' removed"}
{"level":"debug","ts":1654249205.2200477,"logger":"gc","msg":"'/tmp/lu20y91uu6.tmp' removed"}
Office probably died yep, looks like LibreOffice is unable to convert your PPTX (for whatever reason..).
A dirty workaround may be to convert your PTTX to ODP (OpenOffice format), before converting it to PDF.
Hello guys.
This is not a contribution, but a comment on the experience I had while converting pptx into pdf using LibreOffice. In the past, we faced serious problems with a lot of different pptx files, and after some research, we found out that the OnlyOffice plataform does a really good job on converting MS Office documents into PDF.. way better than LibreOffice.
So, I don't really know if this would be an alternative, but I think it would be good to have OnlyOffice, at least as an optional alternative for these kinds of conversions.
@douglascrp indeed, but last time I checked, their license is not great for Gotenberg alas 🥲
Yes, that is true. But as I said, I think it would be nice to have it as an option, if the final user decides to use it.
Hi @gulien, @douglascrp
I was able to workaround the errors I was seeing by giving our gotenberg pod in our cluster increased memory and cpu. I could then successfully convert the troublesome pptx file to a pdf
@keithcaff great! I have to update the documentation with a troubleshooting section now 😅
Documentation updated!
I just encountered this problem today. Minor suggestion, I think its best to document the recommended minimum specification for this service, so people could configure their hardware/container/pod in advance.