Hi,
Make sure the Base64 string represents a valid image.
Hi, Shiva,
Thank you for the help!
I tried the code mentioned in the link page you gave me. But I got the
following error:
===
System.ArgumentException: Invalid parameter used. at
System.Drawing.Image.FromStream(Stream stream, Boolean
useEmbeddedColorManagement, Boolean validateImageData) at
System.Drawing.Image.FromStream(Stream stream, Boolean
useEmbeddedColorManagement) at System.Drawing.Image.FromStream(Stream
stream)
===
Here is the code I used:
---
string sLabel=UPS.UPSShipLabelHtml(); //get Base 64 encoded image string
string sTrackNum=UPS.UPSTrackNum();
if(sLabel.Trim().Length>0)
{
string sf="label"+sTrackNum+".gif";
Byte[] bitmapData=new Byte[sLabel.Length];
//take out space and "\r\n" from sLabel
bitmapData=Convert.FromBase64String(UPS.CleanBase64Image(sLabel));
System.IO.MemoryStream memStream=new System.IO.MemoryStream(bitmapData);
System.Drawing.Bitmap bitImage=new
System.Drawing.Bitmap((System.Drawing.Bitmap)System.Drawing.Image.FromStream
(memStream));
bitImage.Save(MapPath("/docs/"+sf));
}
---
Would you please help me to figure out the problem?
Thank you
hb
Shiva said: