MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to change the ResultFormatType of the MathKernel in a ASP.NET Web Application?


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




  • Prev by Date: Re: Re: J/Link problem on Mac OS X
  • Next by Date: Re: using mathematica over the internet
  • Previous by thread: Re: nonLinearFit and nonLinearRegress
  • Next by thread: Print on Paper