Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: BuddyRobbins_Linquest on July 12, 2018, 08:32:20 am

Title: Getting Images from Pro-Cloud
Post by: BuddyRobbins_Linquest on July 12, 2018, 08:32:20 am
Folks,
I'm using the ProCloud server to retrieve a diagram image.  I'm getting the byte-array in the xml for the image, but I'm unable to turn that image into a picture.  What's the trick?

XmlNode node = document.SelectSingleNode("//rdf:RDF/ss:features/ss:diagramimage/rdf:Description/ss:image", nsmgr);
if( node != null)
{
   string rawData = node.InnerText;
   rawData = rawData.Replace("\r\n", "");
   System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
   byte[] byteArray = encoder.GetBytes(rawData.ToCharArray());
   System.IO.File.WriteAllBytes(@"c:\budTemp\mypic.jpg", byteArray);
}
Title: Re: Getting Images from Pro-Cloud
Post by: Madhav on July 12, 2018, 03:14:45 pm
Hello BuddyRobbins,

What you get for images is not byte-array but base-64 encoded string. You can use it directly as image source.

As per your code, you can use "node" as image source.
Title: Re: Getting Images from Pro-Cloud
Post by: BuddyRobbins_Linquest on July 12, 2018, 11:38:40 pm
Thanks,  That did the trick.