예제 #1
0
    private bool SaveSign(string sByteData, string sFullSignPath)
    {
        System.Drawing.Image img;

        if (sByteData == null)
        {
            return(false);
        }

        SIGPLUSLib.SigPlus sigObj_Patient = new SIGPLUSLib.SigPlus();
        sigObj_Patient.InitSigPlus();

        sigObj_Patient.AutoKeyStart();
        sigObj_Patient.AutoKeyFinish();
        sigObj_Patient.SigCompressionMode = 1;
        sigObj_Patient.EncryptionMode     = 2;
        sigObj_Patient.SigString          = sByteData;

        if (sigObj_Patient.NumberOfTabletPoints() > 0)
        {
            long   size = 0;
            byte[] byteValue;

            sigObj_Patient.ImageFileFormat = 0;
            sigObj_Patient.ImageXSize      = 150;
            sigObj_Patient.ImageYSize      = 75;
            sigObj_Patient.ImagePenWidth   = 8;
            sigObj_Patient.SetAntiAliasParameters(1, 600, 700);
            sigObj_Patient.JustifyX    = 5;
            sigObj_Patient.JustifyY    = 5;
            sigObj_Patient.JustifyMode = 5;

            sigObj_Patient.BitMapBufferWrite();
            size      = sigObj_Patient.BitMapBufferSize();
            byteValue = new byte[size];
            byteValue = (byte[])sigObj_Patient.GetBitmapBufferBytes();

            // byte value to check

            sigObj_Patient.BitMapBufferClose();
            System.IO.MemoryStream ms = new System.IO.MemoryStream(byteValue);

            img = System.Drawing.Image.FromStream(ms);
            img.Save(sFullSignPath, System.Drawing.Imaging.ImageFormat.Bmp);
        }
        return(true);
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Put user code to initialize the page here
        SIGPLUSLib.SigPlus sigObj = new SIGPLUSLib.SigPlus();
        sigObj.InitSigPlus();
        sigObj.AutoKeyStart();

        //use the same data to decrypt signature
        sigObj.AutoKeyData = Request.Form["SigText"];

        sigObj.AutoKeyFinish();
        sigObj.SigCompressionMode = 1;
        sigObj.EncryptionMode     = 2;

        //Now, get sigstring from client
        //Sigstring can be stored in a database if
        //a biometric signature is desired rather than an image
        sigObj.SigString = Request.Form["hidden"];
        if (sigObj.NumberOfTabletPoints() > 0)
        {
            sigObj.ImageFileFormat = 0;
            sigObj.ImageXSize      = 500;
            sigObj.ImageYSize      = 150;
            sigObj.ImagePenWidth   = 8;
            sigObj.SetAntiAliasParameters(1, 600, 700);
            sigObj.JustifyX    = 5;
            sigObj.JustifyY    = 5;
            sigObj.JustifyMode = 5;
            long   size;
            byte[] byteValue;
            sigObj.BitMapBufferWrite();
            size      = sigObj.BitMapBufferSize();
            byteValue = new byte[size];
            byteValue = (byte[])sigObj.GetBitmapBufferBytes();
            sigObj.BitMapBufferClose();

            //System.IO.MemoryStream ms  = new System.IO.MemoryStream(byteValue);

            //byte[] SignData = ms.ToArray();

            Session["signature"] = byteValue;

            //System.Drawing.Image img = System.Drawing.Image.FromStream(ms);

            //String path;

            //path = System.AppDomain.CurrentDomain.BaseDirectory & "mySig.bmp";

            //path = "C:\\mySig.bmp";

            //img.Save(path, System.Drawing.Imaging.ImageFormat.Bmp);

            //Response.Write("Image saved successfully to " + path);
        }
        else
        {
            //signature has not been returned successfully!
        }

        ClientScript.RegisterStartupScript(this.GetType(), "key", "javascript:OnUnload();", true);
    }