Burke Software Blog


python - convert documents (doc, docx, odt, pdf) to plain text without Libreoffice

February 4, 2014

I recently needed to convert some resumes to plain text. There are any number of use cases for wanting to extract readable text from binary formats. So here is a code snippet to do just that. I'm using some non python Linux programs and python libs. Notably absent is Libreoffice which would take care of a ton of formats. Libreoffice is however heavyweight and clunky to use. These programs will convert much faster. First let's get some dependencies.

[gist id=8798262]

Notice - New versions of python-docx removed this function. Make sure to pip install docx and not the new python-docx.