在the official site of SnuggleTex他们写道:
SnuggleTeX具有可选功能,可将生成的MathML转换为图像(使用JEuclid库),还可以尝试将非常简单的MathML表达式转换为XHTML和CSS的混合。
如何使用JEuclid将xmlString解析为图片?
这是我的代码:
/* Create vanilla SnuggleEngine and new SnuggleSession */
SnuggleEngine engine = new SnuggleEngine();
SnuggleSession session = engine.createSession();
/* Parse some very basic Math Mode input */
SnuggleInput input = new SnuggleInput("$$ x+2=3 $$");
session.parseInput(input);
/* Convert the results to an XML String, which in this case will
* be a single MathML <math>...</math> element. */
String xmlString = session.buildXMLString();
MathMLParserSupport.parseString(xmlString);
JEuclidUtilities.createWebPageOptions(true,new MathMLImageSavingCallback() {
@Override
public String getImageContentType(int i) {
return null;
}
@Override
public File getImageOutputFile(int i) {
return null;
}
@Override
public OutputStream getImageOutputStream(int i) {
return null;
}
@Override
public String getImageURL(int i) {
return null;
}
@Override
public MutableLayoutContext getLayoutContext(int i) {
return null;
}
@Override
public void imageSavingSucceeded(Object o, int i, String s) {
}
@Override
public void imageSavingFailed(Object o, int i, String s, Throwable throwable) {
}
});
我不知道如何将xmlString解析为图像。