Converting Microsoft Word documents to PDF programmatically – server side.

We couldn’t find one plain and simple example on the web so we’re posting it here in case it helps someone. Our requirements:

converting DOC and DOCX to PDF from command line, server side.
No X of course. (LibreOffice excluded).
Not just DOC (Antiword excluded).
Debian packages whenever possible (python-docx excluded).

Log in to your server:

sudo apt-get install abiword
abiword --to=pdf --to-name=<your_document_name.pdf> <your_document_name.docx>

That should give you “your_document_name.pdf”. We’re just interested in extracting text, so we’re not sure about format quality.

Enjoy!


Categorised as: Geek


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>