So am using the SignaturePad.PCL nuget package and you can recover a Stream from the plugin that takes the Draw Points and creates an image. Then I am passing that image across to a web service as a base 64 string and displaying it in a web app. Well I found that I was able to get the conversion to base 64 string working like this
//This works on android but not iOS
string base64Str = Convert.ToBase64String(((MemoryStream) theStream).ToArray());
//Works on iOS but not android
string base64Str = Convert.ToBase64String(StreamConvert(theStream));
private byte[] StreamConvert(Stream stream){
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
//For both I use this, unless someone else can figure out a cross platform solution
string base64Str = Convert.ToBase64String(Device.OS == TargetPlatform.Android ? ((MemoryStream) theStream).ToArray() : StreamConvert(theStream));
Anyone know why there is a difference?