Skip to content

bardt/jDoc

 
 

Repository files navigation

jDoc

Edit documents with JavaScript in browser

Overview

This library depends on zip.js library and these APIs optionally:

Supported formats

  • docx
  • txt
  • fb2
  • odt
  • csv
  • tsv
  • rtf

Getting Started

Include script on your page:

<script src="js/jDoc.v.js"></script>

or

<script src="js/jDoc.v.min.js"></script>

where v - library version

You will be available to the global object jDoc

Methods

read

Read the document. Example:

jDoc.read(file, {
    success: function (parsedFile) {

    },

    error: function (error) {

    }
});
  • file - File object
  • parsedFile - object with methods:
    • html - return result as documentFragment
    • data - return result as object {}
  • error - object, {message: ""}

error can be:

  • {message: 'Invalid file format'} - invalid file format
  • {message: 'Can not read file'} - System error reading file
  • {message: 'First argument must be type of File'} - argument 'file' must be instanceof File
  • {message: 'Invalid file type'}
  • {message: 'Can't load the file'}
  • {message: 'Not have the required technology'} - unsupported browser

Grunt

Build a library:

  • grunt readers - build all engines for supported formats
  • grunt readers:include - build all engines for supported formats
  • grunt readers:include --rtf --oxml - build only rtf and oxml engines
  • grunt readers:exclude - exclude all engines from build
  • grunt readers:exclude --rtf --oxml - build all engines for supported formats except rtf and oxml engines

Release History

  • 2013-09-10   v0.1.0   Work in progress, not yet officially released.
  • 2013-11-10   v0.2.0   Support of RTF format.

Library submitted by "webschik" Knyazevich Denis

About

jDoc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors