Topaz签名问题无法保存整个基本64位字符串

时间:2019-01-16 09:59:46

标签: c# sql-server topaz-signatures

我按照本教程将Topaz集成到我的应用程序中

https://blog.sharepointrx.com/2009/09/11/using-topaz-signature-pads-to-capture-signatures-for-infopath-2007-forms/

如果我尝试执行以下操作:if (sigBase64.Length > 2500)它不会将Base64字符串保存到数据库中,但是如果我将if条件删除,它将保存到数据库中但不能完全读取签名,任何人对Topaz有一个想法,为什么不将完整的签名保存到数据库中? 我的代码如下:

private void button5_Click(object sender, EventArgs e)
{
    SigPlus.SetTabletState(0); //tablet off 
    SigPlus.SetImageXSize(400);
    SigPlus.SetImageYSize(100);
    SigPlus.SetImagePenWidth(11);
    SigPlus.SetJustifyMode(5);
    Image sigImage = SigPlus.GetSigImage();
    String sigBase64 = ImageToBase64(sigImage, ImageFormat.Jpeg);            
    string sigString = sigPlusNET1.GetSigString();

    if (sigBase64.Length > 2500)
    {
        string constring = @"Data Source=DESKTOP-FJBB72F\SQLEXPRESS;Initial Catalog=SignatureProcess;Integrated Security=True";
        using (SqlConnection con = new SqlConnection(constring))
        {
            con.Open();
            try
            {
                string insertSql = "insert into signatureProcessNew (sigString,base64Sigstring) values (@sigString,@base64Sigstring)";
                using (SqlCommand cd = new SqlCommand(insertSql, con))
                {
                    cd.Parameters.AddWithValue("@sigString", sigString);
                    cd.Parameters.AddWithValue("@base64Sigstring", sigBase64);
                    cd.ExecuteNonQuery();
                    MessageBox.Show("Data Saved!");
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
            }
        }
    }
    else
    {
        MessageBox.Show("Base B4 more than Length!");
    }
}

0 个答案:

没有答案