mirror of
https://github.com/tbluemel/rtf.js.git
synced 2026-11-30 16:47:59 +01:00
ex:
===
{\field {\*\fldinst import image.WMF}}
{\field {\*\fldinst import image.EMF}}
where:
======
* "image.WMF" is a relative URL path
* the external files are not read by the library
* a new hook function is added to the "settings" Object
that is passed to the "RTFJS.Document()" constructor
* "settings.onImport(relURL, cb)"
* this hook function is responsible for:
* reading data from the external file @ "relURL" into a blob
* mapping the file extension to a "keyword" (ex: "wmetafile")
* passing this information to the callback function with the desired height
* cb({keyword, blob, height})
demo:
=====
samples/04_rtf_imports/rtf.html
1.8 KiB
1.8 KiB
rtf.js
Render RTF documents in HTML. This also includes rendering WMF and EMF images which are often contained in RTF documents.
License
The code of this project is licensed under the MIT license. See the file LICENSE for details.
Dependencies
- rtf.js requires:
- jquery
- js-codepage (Apache 2.0 license)
- wmf.js and emf.js require:
- jquery
- jquery.svg.js plugin with the jquery.svgfilter.js extension.
- Rendering WMF and EMF images is accomplished by using HTML5's
<svg>feature. - Rendering RTF documents often requires rendering embedded WMF and EMF images, however rtf.js can be used without wmf.js and emf.js or with just one of them, if rendering such images is not required.
Live samples:
- RTF document rendering
- WMF image rendering
- EMF image rendering
- RTF document with external WMF image imports
- notes:
- this example uses a WinHelp (.hlp) file borrowed from an old Windows application
- all of the data files are generated by WinHelp decompiler with the command-line:
HELPDECO.EXE HOMEAUDIOMETER.HLP /r /y /n
- notes:
Developing
To develop first install the dependencies using npm install.
Building
To build the entire project and create the bundles run:
$ npm run build
Tests
To run the test suite run:
$ npm run test