MathRendererPlugin class

MathRendererPlugin class

MathRenderer plugin class.

The example shows how to render a LaTeX formula in PNG.

from aspose.pydrawing import Color
from aspose.tex.plugins import MathRendererPlugin, PngMathRendererPluginOptions, StreamDataSource, StringDataSource

#  Create MathRenderer.
renderer = MathRendererPlugin()
options = PngMathRendererPluginOptions()
options.background_color = Color.yellow
options.text_color = Color.blue
options.resolution = 150
options.margin = 10.0
options.preamble = "LaTeX preamble"

#  Create the PngMathRendererPluginOptions instance and set up options.
options = options
#  Add a source formula.
options.add_input_data_source(StringDataSource("LaTeX formula"))
#  Create a stream to write the image to.
with open("output path", "wb") as stream:
    #  Add an output stream.
    options.add_output_data_target(StreamDataSource(stream))
    #  Run the process.
    result = renderer.process(options)

The MathRendererPlugin type exposes the following members:

Constructors

ConstructorDescription
initConstructs a new instance of MathRendererPlugin

Methods

MethodDescription
processRuns Math Renderer processing with the specified parameters.

See Also