Skip to content

xuezier/office-convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OFFICE-CONVERTER

NPM version

use this module, you should confirm LibreOffice and Unoconv installed in your machine.

install LibreOffice

  • on OS X down dmg file from link

  • CentOS / RedHat

    CentOS and RedHat 7.2 自带 OpenOffice 4.3,如果想获得更好的体验,建议更换成LibreOffice,首先要卸载OpenOffice

    yum remove openoffice* libreoffice*

    从 RPM packages 安装LibreOffice

    wget http://download.documentfoundation.org/libreoffice/stable/5.2.5/rpm/x86_64/LibreOffice_5.2.5_Linux_x86-64_rpm.tar.gz
    
    tar -xvf LibreOffice_5.2.5_Linux_x86-64_rpm.tar.gz
    
    cd LibreOffice_5.2.5.x_Linux_x86-64_rpm/RPMS/
    
    yum localinstall *.rpm
    
    libreoffice5.2

install unoconv

  • on OS X

    通过 Homebrew 安装

    brew install unoconv
    brew install ghostscript
  • CentOS / RedHat

    从 github 下载程序包

    git clone https://github.com/dagwieers/unoconv.git
    
    # copy
    cp unoconv/unoconv /usr/bin
    # or link unoconv to /usr/bin
    ln -s unoconv/unoconv /usr/bin/unoconv

warning

unoconv start need use port 2002, so if want register unoconv as a service, should check port usage first.

Usage

var converter = require('office-convert').createConveter();
converter.generate(originFilePath, outputFileType, ouputFilePath).then(console.log).catch(console.error);

if use this module to converting documents, you can start a unoconv listener first

var converter = require('office-convert').createConveter({listener: true});

or

var converter = require('office-convert').createConveter();
converter.listen();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published