Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Decoding the InfoPath picture format (also Ink Picture)

Decoding the InfoPath picture format (also Ink Picture)

  • Comments 3

InfoPath provides two controls which saves pictures inside the XML form (rather than linking to it). When trying to process this XML file outside of InfoPath, you will need to translate the data back into the image binary. InfoPath picture control data and ink picture control data is stored in the XML as base64 encoded data. You will need to decode the base64 picture into binary before it is usable.

Below is a code sample in C# that will do it:

byte[] image = Convert.FromBase64String( s );
MemoryStream memStr = new MemoryStream();
memStr.Write( image, 0, image.Length );
Image img = Image.FromStream( memStr );
img.Save( filename );

Leave a Comment
  • Please add 7 and 8 and type the answer here:
  • Post
Page 1 of 1 (3 items)