Skip to content

Instantly share code, notes, and snippets.

@panuta
Created February 24, 2012 05:14
Show Gist options
  • Save panuta/1897940 to your computer and use it in GitHub Desktop.
Save panuta/1897940 to your computer and use it in GitHub Desktop.
Generate a document thumbnail (doc, xls, ppt and openoffice formats) in Ubuntu Server 10.04
  1. Install OpenOffice headless package

    $ sudo apt-get install openoffice.org-headless openoffice.org-java-common openoffice.org-writer openoffice.org-calc openoffice.org-impress
    
  2. Install UNO python library

    $ sudo apt-get install python-uno unoconv
    
  3. Install necessary fonts (Especially for international language)

    Copy fonts to /usr/share/fonts/truetype/
    

    Then run

    $ fc-cache
    
  4. Run OpenOffice as a service

    $ soffice -headless -nofirststartwizard -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"
    
  5. Convert document to PDF using unoconv command

    $ unoconv -f pdf __[filename]__
    
  6. Create PDF thumbnail by using MuPDF tool

    $ pdfdraw -r 100 -o __[output-thumbnail]__ __[pdf-file]__ 1
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment