How to create a PDF file from .docx from a Linux server?

We use on our production server: the server version of Ubuntu 10. We need to create a document containing text, images and tables in the content and images in the header and footer. Now we use http://phpword.codeplex.com/ to create it, and it does a great job of creating docx files, but we need a pdf version of this file. How can we convert docx to pdf? Or any other library for creating PDF files that allow images in the header / footer? Using Windows components is not a solution. Maybe use openOffice? can it be used on the server version of ubuntu? any other converter for docx to pdf in linux-server environment?

+3
source share
2 answers

If your documents include images using OpenOffice, this is definitely a good solution. Check out PyODConverter if you want to try this.

If this is plain text, you might consider using a simpler solution such as PHPDocx, unoconv, AbiWord, or LiveDocx.

I used OOo in the past to do this (and still use Odt to Pdf to convert files) and it works fine. :) I have only one problem, but it has already been resolved. You can check it out here: Docx to pdf using openoffice headless way too slow

EDIT:

I created a bash script "/etc/init.d/openoffice" to run openoffice with the correct parameters. File contents:

#!/bin/bash
# openoffice.org headless server script
#
# chkconfig: 2345 80 30
# description: headless openoffice server script
# processname: openoffice

OOo_HOME=/usr/lib/openoffice
SOFFICE_PATH=$OOo_HOME/program/soffice

if [ "$1" == "start" ]; then
 echo "Starting OpenOffice headless server"
 $SOFFICE_PATH --headless --accept="pipe,name=beubi_OOffice;urp;StarOffice.ServiceManager" --invisible --norestore --nodefault --nolockcheck --nofirstwizard
 exit
fi

if [ "$1" == "stop" ]; then
 echo "Stopping OpenOffice headless server."
 killall -9 soffice.bin && killall -9 soffice
 exit
fi

echo "Usage: $0 {start|stop}"
exit 1

, .

+5

docx4j (Java). PDF , .

2016

docx PDF, Linux ( Solaris, ); http://converter-eval.plutext.com/, .

+1

Source: https://habr.com/ru/post/1785663/


All Articles