Main Content

getSnapshotImage

Class: mlreportgen.report.Equation
Namespace: mlreportgen.report

Create equation image and return file path or data URL

Syntax

equationImage = getSnapshotImage(equation,report)

Description

equationImage = getSnapshotImage(equation,report) creates an image of the formatted equation and returns the path of the file or data URL that contains the image. The returned value depends on the value of the UseDirectRenderer property of the mlreportgen.report.Equation object specified by equation.

Input Arguments

expand all

Equation reporter object, specified as an mlreportgen.report.Equation object.

Report, specified as a report object. To create the report input, use mlreportgen.report.Report.

Output Arguments

expand all

Equation image file path or data URL, returned as a string scalar. If the UseDirectRenderer property of the mlreportgen.report.Equation object specified by the equation argument is true, equationImage is a data URL that contains an image of the equation. If the UseDirectRenderer property is false, equationImage is the path of the file that contains an image of the equation. Specify the image format by using the SnapshotFormat property of the Equation object.

Examples

Create a Left-Aligned, Numbered Equation

import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('equation','html');
ch = Chapter('Title','Equation');
eq = Equation('\int_{0}^{2} x^2\sin(x) dx');
eq.FontSize = 12;
p = Paragraph('Eq 1: ');
p.Bold = true;
eqImg = Image(getSnapshotImage(eq,rpt));
t = Table({p,eqImg});
add(ch,t);
add(rpt,ch);
close(rpt);
rptview(rpt);

Version History

Introduced in R2017b