Class MathRendererPlugin
Class MathRendererPlugin
Namespace: Aspose.TeX.Plugins
Assembly: Aspose.TeX.dll
MathRenderer 插件类。
示例展示了如何将 LaTeX 公式渲染为 PNG。
// 创建 MathRenderer。
MathRendererPlugin renderer = new MathRendererPlugin();
// 创建 PngMathRendererPluginOptions 实例并设置选项。
PngMathRendererPluginOptions options = new PngMathRendererPluginOptions()
{
BackgroundColor = Color.Yellow,
TextColor = Color.Blue,
Resolution = 150,
Margin = 10,
Preamble = "LaTeX preamble"
};
// 添加源公式。
options.AddInputDataSource(new StringDataSource("LaTeX formula"));
// 创建一个流以将图像写入。
using (Stream stream = File.Open("output path", FileMode.Create))
{
// 添加输出流。
options.AddOutputDataTarget(new StreamDataSource(stream));
// 运行处理。
ResultContainer result = renderer.Process(options);
}
public class MathRendererPlugin : IPlugin, IDisposable
继承
实现
继承成员
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
构造函数
MathRendererPlugin()
public MathRendererPlugin()
方法
Dispose()
释放此实例。
public void Dispose()
Process(IPluginOptions)
使用指定参数运行 Math Renderer 处理。
public ResultContainer Process(IPluginOptions options)
参数
options
IPluginOptions
一个包含 MathRenderer 指令的选项对象。
返回
一个包含操作结果的 ResultContainer 对象。
异常
当给定的选项实例为 null 或类型不合适,或者输入/输出源之一的类型不受支持时。