private void OpenDeviceBtn_Click(object sender, EventArgs e) { BSPError err; if (m_DeviceOpened) { m_SecuBSP.CloseDevice(); m_DeviceOpened = false; } // Get Selected device by User string selected_device = DeviceIDCombo.Text; selected_device = selected_device.Substring(0, 6); Int16 device_id = Convert.ToInt16(selected_device.Substring(0, 6), 16); m_SecuBSP.DeviceID = device_id; err = m_SecuBSP.OpenDevice(); DisplaySecuBSPErrMsg("OpenDevice", err); if (err != BSPError.ERROR_NONE) { return; } m_DeviceOpened = true; }
private void Form1_Load(object sender, EventArgs e) { //FIND err = m_SecuBSP.EnumerateDevice(); m_SecuBSP.DeviceID = (Int16)DeviceID.AUTO; //OPEN err = m_SecuBSP.OpenDevice(); if (err == BSPError.ERROR_NONE) { StatusBar.Text = "Scanner Detected"; } //AUTO-ON if (this.Visible) { m_SecuBSP.MonitorDevice(true, this.Handle); } }
private void Form2_Load(object sender, EventArgs e) { //FIND err = m_SecuBSP.EnumerateDevice(); if (err == BSPError.ERROR_NONE) { m_SecuBSP.DeviceID = (Int16)DeviceID.AUTO; } //OPEN err = m_SecuBSP.OpenDevice(); if (err == BSPError.ERROR_NONE) { StatusBar.Text = "(Scanner Detected)"; } else { StatusBar.Text = "(No Scanner Detected)"; } }
private void VerifySC_Click(object sender, EventArgs e) { err = m_SecuBSP.EnumerateDevice(); pdf = new PdfDocument(); OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "PDF document (*.pdf)|*.pdf"; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { try { string pdfFile = dialog.FileName; List <PdfSignature> signatures = new List <PdfSignature>(); //Open a pdf document and get its all signatures using (PdfDocument pdf = new PdfDocument()) { pdf.LoadFromFile(pdfFile); PdfFormWidget form = pdf.Form as PdfFormWidget; for (int i = 0; i < form.FieldsWidget.Count; i++) { PdfSignatureFieldWidget field = form.FieldsWidget[i] as PdfSignatureFieldWidget; if (field != null && field.Signature != null) { PdfSignature signature = field.Signature; signatures.Add(signature); } } //Get the first signature PdfSignature signatureOne = signatures[0]; //Detect if the pdf document was modified bool modified = signatureOne.VerifyDocModified(); //FIND err = m_SecuBSP.EnumerateDevice(); m_SecuBSP.DeviceID = (Int16)DeviceID.AUTO; //OPEN err = m_SecuBSP.OpenDevice(); if (err == BSPError.ERROR_NONE) { if (!modified) { PdfDocumentInformation docInfo = pdf.DocumentInformation; err = m_SecuBSP.Capture(FIRPurpose.VERIFY); if (err == BSPError.ERROR_NONE) { err = m_SecuBSP.VerifyMatch(m_SecuBSP.FIRTextData, docInfo.Subject); if (err == BSPError.ERROR_NONE) { if (m_SecuBSP.IsMatched) { AutoClosingMessageBox.Show("The Document is Authentic", "", 1500); } else { AutoClosingMessageBox.Show("The Document is not Authentic", "", 1500); } } } } else { AutoClosingMessageBox.Show("The Document is not Authentic", "", 1500); } } else { AutoClosingMessageBox.Show("No Scanner Detected", "Error!", 1000); } } } catch (Exception exe) { MessageBox.Show("Document is not Authentic", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }