public void id003_DecompressSigCompressSig() { //The sample signature will be decompressed and then compression will take place //immediately after that. The end result should be identical to the input. string compressedSig = "4A8865240Z12020020110200Y1442346668865543232010Z14854Y3858a77d65653212001301002544463334324_1TZ243532Ydgeglgb9646Z7ajicob74522000Y114465865a5511016a7c7a5a410Z15463566Y3545541111Z1332653Y1_bS2Z112344200Y25845583464662200Z40000002330Y216333343234_5DZ374331Y3a8667a5110Z34abfbc896Y4885885333Z5351Y233553332_aF_3K"; Base30Converter bc = new Base30Converter(); //Perform the decompression int[][][] dec = bc.Base30ToNative(compressedSig); //Now convert the output back to being compressed string comp = bc.NativeToBase30(dec); //The orignal input should be the same as our latest result Assert.AreEqual(compressedSig, comp); }
public string SaveImagePage(string data) { try { Base30Converter conv = new Base30Converter(); int[][][] bytearray = conv.GetData(data); string actual = jSignature.Tools.SVGConverter.ToSVG(bytearray); var byteArray = Encoding.ASCII.GetBytes(actual); using (var stream = new MemoryStream(byteArray)) { SvgDocument svgDocument = SvgDocument.Open(stream); Bitmap bitmap = svgDocument.Draw(); bitmap.Save(AppDomain.CurrentDomain.BaseDirectory + "DigitalSignatureImages\\" + Guid.NewGuid() + ".png", ImageFormat.Png); } return("Saved"); } catch (Exception) { return("Not Saved!"); } }