Welcome to MSDN Blogs Sign in | Join | Help

InfoPath Team Blog

Tips and tricks to get the most out of Microsoft InfoPath

News

  • For questions, comments, and feedback please use the public newsgroup: microsoft.public.infopath
    This is provided "AS IS" with no warranties, and confers no rights. Use of included script samples and forms are subject to the terms specified in the Terms of Use.
Decoding the InfoPath picture format (also Ink Picture)

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 );

Posted: Wednesday, April 21, 2004 10:33 AM by infopath

Comments

Dylan said:

not bieng a programmer, and this is just a guess, but this is why i haven't been able to get the signature back into an sql database? if that is so, what use does this snippet have for me?
# May 11, 2004 6:27 PM
Anonymous comments are disabled
Page view tracker