NewsappAJC / rtf_parse

Ruby module wraping the GNU utility 'unrtf'

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RtfParse

A ruby miodule wrapping unrtf. The GNU copmmand-line utility, unrtf, uses .config file to determine the output format for the parsed RTF. Output can be customized by modifying these files, which you'll find in the config directory of this gem. The html.config file includes a complete list of formatting tags.

Dependencies

Installation

First install unrtf:

Then install the gem:

gem install rtf_parse

Use

require 'rtf_parse'

To convert RTF to text:

RtfParse.to_text(rtf_text_or_file_path)

To convert RTF to HTML:

RtfParse.to_html(rtf_text_or_file_path)

To use a custom config file:

RtfParse.custom_parse(rtf_text_or_file_path,
  config_path: 'path/to/config/files/',
  tags_file: 'custom_config_file_name'
)

About

Ruby module wraping the GNU utility 'unrtf'

License:MIT License


Languages

Language:Ruby 71.7%Language:Shell 28.3%