StiImage Serialization
StiImage Serialization
I am writing a (one-way) conversion utility to convert reports from our custom system into XML that can be used by the Stimulsoft viewier and designer. I'm having an issue getting the Image (aka, StiImage) token to be accepted by the Stimulsoft viewer.
Can anyone direct me to the code that the Stimulsoft designer uses to serialize the StiImage objects? I need to be able to have the converter utility serialize our report image data in the same format.
Thanks.
...Glenn
Can anyone direct me to the code that the Stimulsoft designer uses to serialize the StiImage objects? I need to be able to have the converter utility serialize our report image data in the same format.
Thanks.
...Glenn
Re: StiImage Serialization
Hello.
The Images are stored in Base64 format.
Thank you.
The Images are stored in Base64 format.
Thank you.
Re: StiImage Serialization
Can you provide a bit more detail?
I am using Base64 but the output that I get in the XML does not match the output that is generated from the Stimulsoft designer. We have the full source but I am not able to find out where the serailization takes place. I was hoping someone could guide me to the correct class and/or method so that I could generate the same output.
As it stands now, the report does not load in the viewer with the Base64-generated output that I create.
...Glenn
I am using Base64 but the output that I get in the XML does not match the output that is generated from the Stimulsoft designer. We have the full source but I am not able to find out where the serailization takes place. I was hoping someone could guide me to the correct class and/or method so that I could generate the same output.
As it stands now, the report does not load in the viewer with the Base64-generated output that I create.
...Glenn
Re: StiImage Serialization
Hello.
What pictures format do you use? Could you send us a sample image? And a report sample that you've got.
Thank you.
What pictures format do you use? Could you send us a sample image? And a report sample that you've got.
Thank you.
Re: StiImage Serialization
I am using a standard jpeg image and am converting it using C# with the following code:
The output in my XML looks like the following:
When I update the report in the Stimulsoft designer and select the very same image file, the output in the XML looks like the following:
The size of my data is approximately 800k whereas the Stimulsoft output is approximately 150k.
...Glenn
Code: Select all
var image = Image.FromFile(pathToImage);
return image.ToBase64();
Code: Select all
<Image>Qk32JwkAAAAAADYAAAAoAAAA9AEAAJABAAABABgAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAAAz8DBD8CBj8AA0AABD8CBEAACD8ABD8CBD8CBD8CBD8CBD
8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD
... <snip> ...
AABEAABD8CBD8CBD8CBD8CBD8CBD8CAz4BBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD8CBD
8CBD8CBD8CBD8CBD8CAz8CBD8C</Image>
Code: Select all
<Image>iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYAAABYs5LGAAHVOUlEQVR42uy993dUV7Yu2un0+zfeeOP98sZ9955zz+ljt3PECQO2wSYKkBAClEOJDCIqZySQBIo
oAgpkEEG5SioFUEagVIqAJJIxuO0+b7415wp775KAciMwPi0Ya1SpalfVDmuvb4ZvfvN3f3jvD/D79/8Mv/sABz7/E3tk4/3/g57PjKcPec7o+fu/Y4/yfP5JnFN8/Y/0Gt/uz2Ib
... <snip> ...
JHgUyqH6Hb9mMBiL4w97/yQu9/yJ3kf/sld9D+39V/oZvqfo/bTPfV1xPd1tKL/7x33/SpcS7p//0fA78mfG6yz8t/b9fQvB/28Mxu8Eu/8kWu3K13/a/W/w/wEKwvtf7jKrn
wAAAABJRU5ErkJggg==</Image>
...Glenn
Re: StiImage Serialization
Hello.
Please, try to use next code:
using (MemoryStream ms = new MemoryStream())
Thank you.
Please, try to use next code:
using (MemoryStream ms = new MemoryStream())
Code: Select all
{
image.Save(ms, ImageFormat.Jpeg);
string base64 = Convert.ToBase64String(ms.ToArray());
}
Re: StiImage Serialization
SUCCESS!!!
Thank you, Aleksey. That worked.
...Glenn
Thank you, Aleksey. That worked.
...Glenn
Re: StiImage Serialization
Hello.
We are always glad to help you.
Let us know if you will need any additional help.
Thank you.
We are always glad to help you.
Let us know if you will need any additional help.
Thank you.