Coder Social home page Coder Social logo

ijzerenhein / rtftohtml Goto Github PK

View Code? Open in Web Editor NEW
21.0 5.0 9.0 32 KB

Parse RTF and write output as an HTML file (written specifically for InDesign generated RTF, but works for any source)

License: MIT License

JavaScript 99.49% Shell 0.51%
rtf html parser converts-rtf in-design rtf2html rtftohtml indesign2html indesigntohtml

rtftohtml's Introduction

rtfToHtml

Converts RTF files into HTML.

This tool has been developed to convert RTF output from Adobe InDesign into (almost) pixel perfect formatted HTML output.

It supports the following features:

  • newline (/par)
  • tabs (/tab)
  • right-aligned tabs (/tqr)
  • tab-stops (/tx)
  • left-indent (/li)
  • colors (/colortbl, /red, /blue, /green, /cf)
  • font-names (/fonttbl)
  • font-size (/fs)
  • bold (/b)
  • italic (/i)
  • text-alignment (/gl, /gc, /gr)
  • paper size (/paperw, /paperh)
  • margins (/margl, /margr, /margt, /margb)

The program itself consists of two parts:

  • A parser (converts RTF into a JSON data-structure)
  • A formatter (currently only HTML output is supported)

Both can be easily extended to add new features and handling of additional RTF control codes.

Command line options

Usage: rtfToHtml [options] rtfFile htmlFile

  Options:

    -h, --help                             output usage information
    -V, --version                          output the version number
    -m, --margins [top,right,left,bottom]  Override margins (twips)
    -w, --width [width]                    Override paperwidth (twips)
    -h, --height [height]                  Override paperheight (twips)
    -va, --vertalign [align]               "top", "center", "bottom"

Contribute

If you like this project and want to support it, show some love and give it a star.

© 2015 Hein Rutjes

rtftohtml's People

Contributors

ijzerenhein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.