Delphi 2010 - Decode Base64 encoded image from XML doc

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-04-15T11:19:46Z Indexed on 2010/04/15 11:23 UTC
Read the original article Hit count: 829

I am trying to decode a base64 encoded EMF image from an XML document in my application and render it on screen, however, it never seems to appear.

If I copy/paste the data from the XML document into Notepad++ and use the Base64 Decode option and save the file as a .emf it opens fine in mspaint. So I think the issue is how I am decoding it.

I have tried the following decode methods described in these articles:

How to encode / decode Base 64 string
http://www.swissdelphicenter.ch/torry/showcode.php?id=1223

I have also tried the TIdDecoderMIME class to no avail.

Does anyone know the most reliable way of decoding a base64 encoded string from XML?

© Stack Overflow or respective owner

Related posts about delphi-2010

Related posts about xml-serialization