コード例 #1
0
        /// <summary>
        /// Return the signature svg of a signature field
        /// </summary>
        /// <param name="id">The id of the signature field</param>
        /// <returns>An image of the signature</returns>
        public string Image(Guid id)
        {
            var coreEntitiesContainer = new CoreEntitiesContainer();
            
            var signatureField = coreEntitiesContainer.Fields.OfType<SignatureField>().FirstOrDefault(sf => sf.Id == id);
            if (signatureField == null) return null;

            //Data must be stored using https://github.com/brinley/jSignature base30 format
            var data = new jSignature.Tools.Base30Converter().GetData(signatureField.Value);
            
            string svg = jSignature.Tools.SVGConverter.ToSVG(data);
            return svg;
        }
コード例 #2
0
        public void id003_ToSVG_External()
        {
            var data = new jSignature.Tools.Base30Converter().Base30ToNative("3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4");

            string actual = jSignature.Tools.SVGConverter.ToSVG(data);

            var sampleFilePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "./samples/reference_svg_smoothed.svg");

            Assert.IsTrue(File.Exists(sampleFilePath), "Sample File not found!");

            string shouldbe = System.IO.File.ReadAllText(sampleFilePath);

            Assert.AreEqual(shouldbe, actual);
        }