Giter Site home page Giter Site logo

charliejuc / easy-office-converter Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 1.21 MB

An easy way to convert any office or libreoffice format. Also allow convert to pdf and html formats.

License: MIT License

CSS 7.35% HTML 54.35% JavaScript 38.30%

easy-office-converter's Introduction

#easy-office-converter

##INPUT SUPPORTED FORMATS

  1. Any office or libreoffice format. (ppt, pptx, xls, xlsx, odt, doc...)

##OUTPUT SUPPORTED FORMATS

  1. pdf
  2. html
  3. Any office or libreoffice format. (ppt, pptx, xls, xlsx, odt, doc...)

##USAGE

var officeConverter = require('easy-office-converter')

var converter = officeConverter('./foo/foo.ppt', {
	allowQueue: true, //optional, default is true, more information bellow.
	timeout: 500 //optional, 500 ms is the default value
})

var output_options = {
	outputDir: './media/', //optional, use file to convert directory as default value
	outputFormat: 'pdf' //parameter required
}

converter.convert((err, file_path) => {
	//Do something when convert the file
}, output_options)

var output_options = {
	outputDir: './media/', //optional, use file to convert directory as default value
	outputFormat: 'html' //parameter required
}

converter.convert((err, file_path) => {
	//Do something when convert the file
}, output_options)

##OPTIONS

  • allowQueue(default:true): This module uses internally unoconv and libreoffice. Libreoffice has problems when there are many "soffice.bin" instances. Then by default this module checks if another instance is running and wait until it is done, so we avoid strange error messages and we can guarantee a successful conversion. Changing this option to false none of this will be done.
  • timeout(default:500): Time in milliseconds to wait for complete conversion.

##DEPENDENCIES We need unoconv and libreoffice to convert the files: https://github.com/dagwieers/unoconv

On ubuntu or debian you can exec:

apt-get install unoconv libreoffice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.