Render Office MathML to image
Node module for converting Office MathML objects to images
npm to install package
npm install omml2img
The usage of module is very simple. All you need is pass to a function named
renderFromString omml-text, options for renderer(optional) and callback. In that callback you will get the image data (if everything succes) or error (the Error instance if something went wrong). For example:
require'omml2img'renderFromStringstring_with_omml file_type: 'jpeg' encoding: 'base64'iferrorconsole.error'Oops :(' error;elseconsole.log'OK! The image is' imagedata;;
There are few options that you can pass to a
renderFromString function in
encoding- In which encoding image data will be returned. Default - utf8
backgroundColor. Default - white
fontColor. Default - 40
file_type- File type for image. Default - png
remove_file- Do you need to delete image file after parsing. If not there will be file path in result object. Default - true.
Many of them identical with mml2xxx generator.
There is special constant
DEBUG in source code. If it's true, information about rendering and execution will be printed to console.
Dependencies & Requirements
The module uses JEuclid that work on Java. So Java must be installed on machine. Also, module will work only on linux. Sorry for that. The libraries and programms you must install too use module: