unrtf
Converts RTF documents to HTML. It features two engines that performs a bit differently, so you might try both on your RTF data.
Install
By default the only prerequisite is to install Python. Then install this module:
npm install unrtf
Example
var unrtf = ; ;
API
unrtf(doc, [options], callback)
doc
Type: string (required)
The input RTF document you want to convert.
options
Type: object (optional)
Two options are supported:
- engine, choose the RTF converter engine, either "pyth" (default) or "unrtf"
- unclean, if set to true it will not try to clean up the resulting HTML code, only applies to
unrtf
engine (default false) - timeout, set the timeout of calling the
unrtf
command in milliseconds (default 2000)
callback
Type: function (required)
Invoked with the result or error, if any.
Engines
You can choose between two engines:
- "pyth" (default), depends on Python being installed on your system
- "unrtf", depends on a command line utility
If you want to use the unrtf engine, you need to first install the utility:
- Mac:
brew install unrtf
- Ubuntu:
aptitude install unrtf
- Windows: find the Windows installer here
You can set the default engine:
var unrtf = ; unrtfdefaultEngine = 'unrtf';
License
The code for node-unrtf is licensed under the MIT license. See license.txt
file for more info.