private void btnSign_Click(object sender, EventArgs e)
{
SAPIWSWrapper SapiWS = new SAPIWSWrapper();
if (this.txtPDFFile.Text.Trim().Length < 3)
{
MessageBox.Show("Please select PDF file to Sign", "Error");
this.txtPDFFile.Focus();
return;
}
if (this.txtUsername.Text.Trim().Length < 1)
{
MessageBox.Show("Please Define UserName", "Error");
this.txtUsername.Focus();
return;
}
if (this.txtPassword.Text.Trim().Length < 1)
{
MessageBox.Show("Please define CoSign password", "Error");
this.txtPassword.Focus();
return;
}
bool res = SapiWS.SignPDFFile(txtPDFFile.Text, txtUsername.Text, txtPassword.Text, (int)nudX.Value, (int)nudY.Value,
(int)nudWidth.Value, (int)nudHeight.Value, (int)nudPage.Value, true);
if (!res)
MessageBox.Show("Signing Failed", "SAPI WS Demo");
else
MessageBox.Show("Signature was applied successfully", "SAPI WS Demo");
}