willowsystems / jSignature

jQuery plugin - draw signature in browser.
720 stars 266 forks source link

SignatureDataConversion_dotNet help #43

Open LeoColombi opened 10 years ago

LeoColombi commented 10 years ago

Hello, I need some clarification about .net method to convert jsignature exported data. I have an app sending base30 compressed data (for example "quaok1C2S3Q3W3A2A2I1Uk1y800Z6c1y1y1W2G2w2C2u1O1M1wie800Y2ccm1A1C1Q1S1U2G2y2M1O1u1y4424681y1C1Q2M2Q2w2A2woce_dC200Z2688408ccoeiamiga800000Y48gic1u1ucmaes866402000Z224420000000000002") and a .Net web service receving data in order to save them to database and do some business. At the moment I'm experimenting some problem in converting data from base 30 to image. As example, I'm referring to the SignatureDataConversion_dotNet code in the "extras" folder of the jsignature zip in order to do the conversion and manage data. But something is not working for me...or, maybe, I've not understood how to manage base30 signature in .Net

This is a piece of the code I'm using:

Base30Converter conv = new Base30Converter(); int[][][] bytearray = conv.GetData(base30_string_from_app); string actual = jSignature.Tools.SVGConverter.ToSVG(bytearray); var byteArray = Encoding.ASCII.GetBytes(actual); using (var stream = new MemoryStream(byteArray)) { var svgDocument = SvgDocument.Open(stream); var bitmap = svgDocument.Draw(); bitmap.Save("D:\prova.png", ImageFormat.Png); }

But the image I get is a "partion" of the whole signature sent, with only some strokes. I've also checked the string I am manipulating: it is the same of what the app is sending. As confirmation of this I succed in importing it on a html canvas, using jSignature "setData" method.

Thanks in advance for any help

LeoColombi commented 10 years ago

As another example of the probable issue with the base30 conversion to svg in .Net, here we have the svg conversion of a signature exportet from http://willowsystems.github.io/jSignature/#/demo/

[svg] <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

this is the base 30 conversion of the same sign:

7yf1Ul1H4232121Z4577dabdllhhne1uf6423Y2587ddn1v1x1G1A1D1wpordd8431Z1338ffppkm1v1Db964210Y158b46ffgqkhqfef8673523_3EZ2519332455410Y315329745ba9me5343421200100000Z22345233345323311000Y142853746743121000Z10041112224332_jVZ746ba553200Y12368cabceb8a74200Z234a4ebcebfdbc65Y68afjdjd9f864334_4SZ110000Y3368745322000000Z1123355584323113000000Y31Z101101201001221

Trying to convert it using

            Base30Converter conv = new Base30Converter();
            int[][][] bytearray = conv.GetData(stream_to_convert);
            string actual = jSignature.Tools.SVGConverter.ToSVG(bytearray);

i get:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

As you can see the two "svg" conversion seems to be different. So, maybe, there is something not working properly in the jSignature.Tools for .Net ...

LeoColombi commented 10 years ago

You can see examples here:

SVG from jsignature site: https://dl.dropboxusercontent.com/u/77767500/SVG_from_jsignature_site.svg

SVG from jsignature .net lib: https://dl.dropboxusercontent.com/u/77767500/SVG_from_jsignature_lib.svg