Convert office files(ppt, excel, doc...) to images on CentOS 6.5

There’s a requirement in my recent project to convert office files to multiple images. After hard work for a week, I found the correct steps that cannot be searched through Google. I’m going to write it down, hope these steps save your time.


Use unoconv to convert office files to PDF, then convert PDF to images leveraging ImageMagick.

Install unoconv

  1. Visit Download RPMforge for CentOS 6 via wget. In my case, I downloaded i686 rpm.


Run following command to install the rpm key:

rpm –import

Run rpm -Uvh to install the downloaded rpm file.

  1. Create a file Archives.repo under /etc/yum.repos.d/. Add following contents to Archives.repo :

[c6-archives] name=CentOS-6 – Archives baseurl=$basearch/ gpgcheck=0 enabled=1

  1. Run following comand:

yum clean all

  1. Run following command:

yum install unoconv

Install ImageMagick

Run following command:

yum install ImageMagick

Install Fonts

CentOS does not support enough fonts by default (e.g Chinese fonts). Therefore the converted file may contain unexpected characters. The easiest way to resolve this issue is to copy fonts from Windows.

  1. Create a folder named win in driver D of your Windows.

  2. Copy all files under C:\WINDOWS\Fonts to D:\win.

  3. Upload folder win to your CentOS 6.5 server(via winscp, or FTP tools).

  4. Run following command in CentOS:

mv win /usr/share/fonts

cd win



fc-cache  -fv

  1. Restart CentOS server.


Using following commands to convert an office file to images:

First convert office file to pdf:

‘unoconv -f pdf resume.ppt’

Convert pdf to images:

mkdir resume

‘convert resume.pdf resume/resume_%03d.jpg’

I’ve written a nodeJS wrapper:

var sys = require(‘sys’);

var exec = require(‘child_process’).exec;

console.log(‘converting to pdf…’);

exec(‘unoconv -f pdf resume.ppt’, function(error, stdout, stderr){

console.log(‘converted resume.pdf’);

console.log(‘converting resume.pdf to multiple pics…’);

exec(‘convert resume.pdf resume/resume_%03d.jpg’, function (error, stdout, stderr){

console.log(‘All done’);



That’s all. Cheers!

Written on October 2, 2014