views:

22

answers:

1

Hi folks,

I have a .NET windows application that collects ink using Microsoft.Ink from Microsoft Tablet PC SDK and stores it in a database. That's working fine.

Now I need to display this ink as an image in an ASP.NET application.

Note that I don't need to capture any strokes in the web application. Just display the already captured strokes as an image. I don't know how to proceed. I think I can't use Renderer.Draw in a web page.

Please help, friends

EDIT: Thanks for the help. Here's the sample code if anybody needs it:

        Response.Clear();
        Response.ContentType = "image/jpeg";
        Byte[] isf = Convert.FromBase64String("AI8BHQS6AoQBAwRIEEU1CoABNofwCMeAU9BIREIpEoZCoJpCdyGDxCUYCi8ZicV3rFIRAILEchwGGx/MEQgkD1FBoIyBBoJAoFN53LY/EYPU4LAwh+sa6m2HwCLSacReHwGDatQ2Qy2f4PkMVhcB4FiSxWARSVbmiMHguyYfBYFdSESWNSSZTySRaQSqbUCjwYA="); // Sample
        ink.Load(isf);
        Byte[] imageData = ink.Save(PersistenceFormat.Gif);
        Response.BinaryWrite(imageData);
        Response.End();

Here's the image tag in the page to display it:

    <img alt="" src="RenderImage.aspx" />
+1  A: 

http://msdn.microsoft.com/en-us/library/aa515948.aspx

Is it possible that you serialize your ink object to this format? In this case you will just treat it as an image on your website, while still having an option of deserializating it into another instance of Ink class

ULysses
You're right. It is stored as ISF format. But how to I convert that to an image? I tried using Convert.FromBase64String to convert that to a Byte array. But it doesn't display. I'll put the code in the question for readability.
HappyCoder4U
I believe Response.ContentType should be `image/gif`, or just `image` - in the latter case the browser will try to figure the format outIf that doesn't help, try creating an Image object from the data you get from ink.Save(), then save the Image directly to the output stream. Maybe the metadata that the ink gif holds breaks the browser's logic... but that's improbable.
ULysses