Node module for converting Office MathML objects to images in PNG, GIF and JPEG formats
Use npm
to install package
npm install omml2img
The usage of module is very simple. All you need is pass to a Promise-function named renderFromString
omml-text and options for renderer (optional). In then-method you will get the image data (if everything succes) or error in the catch-method. For example:
require('omml2img').renderFromString(string_with_omml, {file_type: 'jpeg', encoding: 'base64' })
.then(function (image) {
console.log('OK! The image is', image.data);
})
.catch(function (err) {
console.error('Oops :(', err);
);
There are few options that you can pass to a renderFromString
function in options
object:
tmp_dir
- Path to temporary directory. Default -files
in the module directoryencoding
- In which encoding image data will be returned. Default - utf8backgroundColor
- Background color of image file. Default - whitefontColor
- Font size uses in image file. Default - 40file_type
- File type for image. Default - pngremove_file
- Flag for a delete a temporary files. Default - true
Also are avaliabe two options for debugging:
debug
- Option to enable debug logging. Default - falsecolorize
- Option to colorize log output. Default - false
The module uses JEuclid that work on Java. So Java must be installed on machine. The libraries and programms you must install too use module: