How to change the ResultFormatType of the MathKernel in a ASP.NET Web Application?
- To: mathgroup at smc.vnet.net
- Subject: [mg55295] How to change the ResultFormatType of the MathKernel in a ASP.NET Web Application?
- From: "Javier Chicote" <goraperas at hotmail.com>
- Date: Fri, 18 Mar 2005 05:34:39 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I would like to change the ResultFormatType of my ASP.NET Web Application,
so that I could show the result of the Compute() method in a smart format.
(For example, TraditionalForm instead of OutputForm). I looked in the API
help and saw that the type of Result is a System.Drawing.Image.
In the past I learnt how to show the image of the mathKernel.Graphics result
in my application, using a WebForm with contentType="image/jpeg". The code
of the Page_Load was like this:
private void Page_Load(object sender, System.EventArgs e)
{
image = mathKernel.Link.EvaluateToImage(input,200,200);
image.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg);
}
That worked perfectly, and now I would like to show the image of the
mathKernel.Result:
private void Page_Load(object sender, System.EventArgs e)
{
mathKernel.ResultFormat =
Wolfram.NETLink.MathKernel.ResultFormatType.TraditionalForm;
mathKernel.Compute(input);
image = (System.Drawing.Image)Global.mathKernel.Result;
image.Save(Response.OutputStream,
System.Drawing.Imaging.ImageFormat.Jpeg);
}
And this does NOT work, and I cannot see the image. How can I solve my
problem and show the result of the Compute() method using the
TraditionalForm of the ResultFormatType.
Thanks,
Javier Chicote