I am using gdpicture dot net 9 inside a silverlight control.
I am trying to use the string data obtained from the SaveAsString function into a Image control using the following code:
...
Code: Select all
string MS;
MS=oGdPictureImaging.SaveAsString(ImageID, 4, 0);
UTF8Encoding unen = new UTF8Encoding();
byte[] bArray=unen.GetBytes(MS);
using (Stream s = GenerateStreamFromString(bArray))
{
s.Seek(0, SeekOrigin.Begin);
BitmapImage b = new BitmapImage();
b.SetSource(s);
PagePreview.Source = b;
}
public Stream GenerateStreamFromString(byte[] s)
{
MemoryStream stream = new MemoryStream();
for (int i = 0; i < s.Length; i++)
{
stream.WriteByte(s[i]);
}
stream.Position = 0;
return stream;
}
I tried tu use the Unicode encoding as well with the same result
Thank you in advance