All Projects → ryanhanwu → Unoconv-Promise

ryanhanwu / Unoconv-Promise

Licence: Apache-2.0 license
Node.js wrapper with Promise for converting documents with unoconv

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to Unoconv-Promise

Chromehtmltopdf
Convert HTML to PDF with Chrome
Stars: ✭ 122 (+838.46%)
Mutual labels:  convert
Termsql
Convert text from a file or from stdin into SQL table and query it instantly. Uses sqlite as backend. The idea is to make SQL into a tool on the command line or in scripts.
Stars: ✭ 230 (+1669.23%)
Mutual labels:  convert
HEIF
Mac OS X: Convert any image to HEIF/HEIC format
Stars: ✭ 58 (+346.15%)
Mutual labels:  convert
Silk V3 Decoder
kn007's blog
Stars: ✭ 1,832 (+13992.31%)
Mutual labels:  convert
Xresloader
跨平台Excel导表工具(Excel=>protobuf/msgpack/lua/javascript/json/xml)
Stars: ✭ 161 (+1138.46%)
Mutual labels:  convert
X2struct
Convert between json string and c++ object. json字符串和c++结构体之间互相转换
Stars: ✭ 251 (+1830.77%)
Mutual labels:  convert
Notion To Anki
Easily convert your Notion Toggles to Anki flashcards ⭐️
Stars: ✭ 102 (+684.62%)
Mutual labels:  convert
convert-ebook
转换电子书格式(azw3、epub、mobi)
Stars: ✭ 97 (+646.15%)
Mutual labels:  convert
Fonteditor Core
fonteditor core functions
Stars: ✭ 207 (+1492.31%)
Mutual labels:  convert
ttml2srt
convert TTML subtitles to SRT subtitles
Stars: ✭ 46 (+253.85%)
Mutual labels:  convert
Magick.net
The .NET library for ImageMagick
Stars: ✭ 2,071 (+15830.77%)
Mutual labels:  convert
Gelatin
Transform text files to XML, JSON, or YAML
Stars: ✭ 150 (+1053.85%)
Mutual labels:  convert
C4go
Transpiling C code to Go code
Stars: ✭ 253 (+1846.15%)
Mutual labels:  convert
Markdown Themeable Pdf
ARCHIVED. NOT MAINTAINED. Themeable Markdown Converter (Print to PDF, HTML, JPEG or PNG)
Stars: ✭ 130 (+900%)
Mutual labels:  convert
undatum
undatum: a command-line tool for data processing. Brings CSV simplicity to JSON lines and BSON
Stars: ✭ 39 (+200%)
Mutual labels:  convert
Cube2sphere
Python script to map 6 cube (cubemap, skybox) faces into an equirectangular (cylindrical projection, skysphere) map.
Stars: ✭ 120 (+823.08%)
Mutual labels:  convert
Markdown Pdf
Convert markdown to pdf, png or jpeg on the fly in Atom
Stars: ✭ 250 (+1823.08%)
Mutual labels:  convert
from-exponential
Lightweight module to convert number from exponential notation to a human readable string.
Stars: ✭ 27 (+107.69%)
Mutual labels:  convert
node-pdftocairo
📃 Node.js wrapper for pdftocairo - PDF to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo
Stars: ✭ 17 (+30.77%)
Mutual labels:  convert
Flacon
Audio File Encoder. Extracts audio tracks from an audio CD image to separate tracks.
Stars: ✭ 252 (+1838.46%)
Mutual labels:  convert

Unoconv Promise

npm build JS.ORG

This is a Node.js wrapper with native Promise support for converting documents with unoconv, inspired by Graham Floyd's implementation

Setup

Requirement

Mac Only

With Homebrew

$ brew install unoconv

and in order to use unoconv, a copy of LibreOffice between versions 3.6.0.1 - 4.3.x must be installed.

Installation

$ npm install unoconv-promise

Usage

Basic

Convert document file into PDF and return as a Buffer

const unoconv = require("unoconv-promise");

unoconv
  .convert("./mydoc.doc")
  .then(fileBuffer => {
    // Converted file buffer
    return Promise.resolve(fileBuffer);
  })
  .catch(e => {
    throw e;
  });

Convert document first page to PDF and save to a file

const unoconv = require("unoconv-promise");

unoconv
  .run({
    file: "./mydoc.doc",
    output: "./temp.pdf",
    export: "PageRange=1-1"
  })
  .then(filePath => {
    console.log(filePath);
  })
  .catch(e => {
    throw e;
  });

Show supported formats

const unoconv = require("unoconv-promise");

unoconv
  .formats()
  .then(formats => {
    // formats will be an array contains supports formats
    formats.forEach(format => {
      console.log(format);
    });
  })
  .catch(e => {
    throw e;
  });
  • Each format will be look like this
{
  "format": "doc",
  "doctype": "document",
  "extension": "doc",
  "description": " Microsoft Word 97/2000/XP",
  "mime": "application/msword"
}

Unoconv.run options

Option (default) : Description

From unoconv Please check unoconv -h more details

  • connection
  • doctype
  • export
  • field
  • fields: object contanig user-defined text fields with values to be relaced in the document
  • format(pdf): specify the output format
  • import-filter-name
  • import
  • listener
  • no-launch
  • output: output basename, filename or directory
  • password
  • pipe
  • port
  • printer
  • preserve: keep timestamp and permissions of the original document
  • server
  • show
  • stdout
  • template
  • timeout: timeout after secs if connection to listener fails
  • verbose
  • version

Extra

  • bin (unoconv): Binary command
  • unoconv (unoconv): Unoconv custom path
  • python (python): Python custom ptah
  • string (false): Return the output as string
  • file (null): Target file

Testing

npm test
  • Coverage
npm test:coverage

Supported Formats

  • bib
  • bmp - image/bmp
  • csv - text/csv
  • dbf
  • dif
  • doc - application/msword
  • docx - application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • emf - application/x-msmetafile
  • eps - application/postscript
  • fodg
  • fodp
  • fods
  • fodt
  • gif - image/gif
  • html - text/html
  • jpg - image/jpeg
  • ltx
  • met
  • odd
  • odg - application/vnd.oasis.opendocument.graphics
  • odp - application/vnd.oasis.opendocument.presentation
  • ods - application/vnd.oasis.opendocument.spreadsheet
  • odt - application/vnd.oasis.opendocument.text
  • otg - application/vnd.oasis.opendocument.graphics-template
  • otp - application/vnd.oasis.opendocument.presentation-template
  • ots - application/vnd.oasis.opendocument.spreadsheet-template
  • ott - application/vnd.oasis.opendocument.text-template
  • pbm - image/x-portable-bitmap
  • pct - image/x-pict
  • pdb - application/vnd.palm
  • pdf - application/pdf
  • pgm - image/x-portable-graymap
  • png - image/png
  • pot - application/vnd.ms-powerpoint
  • potm - application/vnd.ms-powerpoint.template.macroenabled.12
  • ppm - image/x-portable-pixmap
  • pps - application/vnd.ms-powerpoint
  • ppt - application/vnd.ms-powerpoint
  • pptx - application/vnd.openxmlformats-officedocument.presentationml.presentation
  • psw
  • pwp
  • pxl
  • ras - image/x-cmu-raster
  • rtf - application/rtf
  • sda - application/vnd.stardivision.draw
  • sdc - application/vnd.stardivision.calc
  • sdd - application/vnd.stardivision.impress
  • sdw - application/vnd.stardivision.writer
  • slk
  • stc - application/vnd.sun.xml.calc.template
  • std - application/vnd.sun.xml.draw.template
  • sti - application/vnd.sun.xml.impress.template
  • stw - application/vnd.sun.xml.writer.template
  • svg - image/svg+xml
  • svm
  • swf - application/x-shockwave-flash
  • sxc - application/vnd.sun.xml.calc
  • sxd - application/vnd.sun.xml.draw
  • sxi - application/vnd.sun.xml.impress
  • sxw - application/vnd.sun.xml.writer
  • tiff - image/tiff
  • txt - text/plain
  • uop
  • uos
  • uot
  • vor - application/vnd.stardivision.writer
  • wmf - application/x-msmetafile
  • wps - application/vnd.ms-works
  • xhtml - application/xhtml+xml
  • xls - application/vnd.ms-excel
  • xlsx - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • xlt - application/vnd.ms-excel
  • xml - application/xml
  • xpm - image/x-xpixmap'

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].