public interface MathMLImageSavingCallback
JEuclidMathMLPostProcessor to determine
where to save each generating MathML image and the URL to use in the resulting
HTML as it traverses a given DOM Document.
You should implement this to do whatever is appropriate for your needs.
This can be used independently of SnuggleTeX.
JEuclidMathMLPostProcessor| Modifier and Type | Method and Description |
|---|---|
String |
getImageContentType(int mathmlCounter)
Implement to return the desired MIME type for the resulting image.
|
File |
getImageOutputFile(int mathmlCounter)
Implement if you want the resulting image to be written to a
File of your choice. |
OutputStream |
getImageOutputStream(int mathmlCounter)
Implement this if you want the resulting image to be written to an
OutputStream of
your choice. |
String |
getImageURL(int mathmlCounter)
Implement to return the URL String that will be put into the
img src
attribute to refer to the image. |
net.sourceforge.jeuclid.MutableLayoutContext |
getLayoutContext(int mathmlCounter)
Implement to fill in the JEuclid
MutableLayoutContext specifying how you want to
render this image. |
void |
imageSavingFailed(Object imageFileOrOutputStream,
int mathmlCounter,
String contentType,
Throwable exception)
Called back if MathML image could not be saved for some reason.
|
void |
imageSavingSucceeded(Object imageFileOrOutputStream,
int mathmlCounter,
String contentType)
Called back once a MathML image has been saved successfully.
|
String getImageContentType(int mathmlCounter)
Consult the JEuclid documentation for what is supported; you may need to add additional libraries for certain MIME types.
SnuggleTeX contains everything required to support PNG. Note that conversion to GIF does not generally work well so should be avoided...!
mathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.File getImageOutputFile(int mathmlCounter)
File of your choice.
Return null if you want the image to be written to the result of
getImageOutputStream(int) instead.mathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.OutputStream getImageOutputStream(int mathmlCounter)
OutputStream of
your choice. The method getImageOutputFile(int) is checked first, so must return
null in this case.mathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.String getImageURL(int mathmlCounter)
img src
attribute to refer to the image.mathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.net.sourceforge.jeuclid.MutableLayoutContext getLayoutContext(int mathmlCounter)
MutableLayoutContext specifying how you want to
render this image.mathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.void imageSavingSucceeded(Object imageFileOrOutputStream, int mathmlCounter, String contentType)
imageFileOrOutputStream - File or OutputStream writtenmathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.contentType - content type of the saved image Filevoid imageSavingFailed(Object imageFileOrOutputStream, int mathmlCounter, String contentType, Throwable exception)
imageFileOrOutputStream - File or OutputStream that would have
been written if successfulmathmlCounter - identifies the position of the image within the document being processed,
which can be used to ensure unique file names.contentType - content type of the saved image Fileexception - cause of the failure, which may be nullCopyright © 2008–2026 The University of Edinburgh. All rights reserved.