private void ReceiverSign_Click(object sender, EventArgs e) { if (txtAccountName.Text == "") { MessageBox.Show("Please Input data"); } else { DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, "ลายมือชื่อผู้รับเงิน", "แบบฟอร์มใบถอนเงิน", null, null); if (res == DynamicCaptureResult.DynCaptOK) { sigObj = (SigObj)sigCtl.Signature; sigObj.set_ExtraData("AdditionalData", "C# Test"); try { byte[] binaryData = sigObj.RenderBitmap("", 173, 79, "image/png", 1.5f, 0xff0000, 0xffffff, 10.0f, 10.0f, RBFlags.RenderOutputBinary | RBFlags.RenderColor32BPP) as byte[]; using (MemoryStream memStream = new MemoryStream(binaryData)) { System.Drawing.Image newImage = System.Drawing.Image.FromStream(memStream); ReceiverSign.Image = newImage; memStream.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
public byte[] captureSignature() { SigCtl sigCtl = new SigCtl(); DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, Properties.Settings.Default.DefaultName, Properties.Settings.Default.DefaultReason, null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; //sigObj.set_ExtraData("AdditionalData", "C# test: Additional data"); String filename = System.IO.Path.GetTempFileName(); try { byte[] signature = sigObj.RenderBitmap(null, 400, 200, "image/png", 0.5f, 0xff0000, 0xffffff, 10.0f, 10.0f, RBFlags.RenderOutputBinary | RBFlags.RenderColor32BPP | RBFlags.RenderEncodeData | RBFlags.RenderBackgroundTransparent); return(signature); } catch (Exception ex) { MessageBox.Show(ex.Message); } } return(null); }
public void sign() { SigCtl sigCtl = new SigCtl(); DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, "Name", "Reason", null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; //sigObj.set_ExtraData("AdditionalData", "C# test: Additional data"); String filename = System.IO.Path.GetTempFileName(); try { sigObj.RenderBitmap(filename, 400, 200, "image/png", 1.0f, 0x000000, 0xffffff, 5.0f, 5.0f, RBFlags.RenderOutputFilename | RBFlags.RenderColor32BPP | RBFlags.RenderEncodeData | RBFlags.RenderBackgroundTransparent); Range activecell = Globals.ThisAddIn.Application.Selection; Worksheet ws = Globals.ThisAddIn.Application.ActiveSheet; Microsoft.Office.Interop.Excel.Shape signature = ws.Shapes.AddPicture(filename, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue, activecell.Left, activecell.Top, 400, 200); signature.Placement = XlPlacement.xlMoveAndSize; signature.Height = (float)activecell.Height; signature.Width = (float)activecell.Width; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnSign_Click(object sender, EventArgs e) { if (txtName.Text.Trim().Length == 0) { MessageBox.Show("Please enter name"); return; } if (txtEmail.Text.Trim().Length == 0) { MessageBox.Show("Please enter email"); return; } SigCtl sigCtl = new SigCtl(); DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, txtName.Text, "Reference", null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; try { SigText = sigObj.RenderBitmap(null, 400, 200, "image/png", 0.5f, 0xff0000, 0xffffff, 10.0f, 10.0f, RBFlags.RenderOutputBase64 | RBFlags.RenderColor32BPP | RBFlags.RenderEncodeData); txtSigText.Text = SigText.Substring(0, 50) + ".."; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public SigObj CaptureSignature(string name, string reason) { SigCtl sigCtl = new SigCtl(); DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, name, reason, null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; return(sigObj); } return(null); }
private void BTN_SIGNPAD_CHECK_Click(object sender, EventArgs e) { Boolean signColumn = Constants.SQLITE_MANAGER.ExitsTableColumn("SLIP_PRINT_DOCS", "SIGN"); if (!signColumn) { Constants.SQLITE_MANAGER.alterTable("SLIP_PRINT_DOCS", "SIGN"); } SigCtl sigCtl = new SigCtl(); sigCtl.InkColor = 0x000000; sigCtl.Licence = "AgAkAEy2cKydAQVXYWNvbQ1TaWduYXR1cmUgU0RLAgKBAgJkAACIAwEDZQA"; DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, "TEST SIGN", "SIGN TEST", null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; sigObj.set_ExtraData("AdditionalData", "C# test: Additional data"); } else { switch (res) { case DynamicCaptureResult.DynCaptCancel: MessageBox.Show("signature cancelled"); break; case DynamicCaptureResult.DynCaptError: MessageBox.Show("no capture service available"); break; case DynamicCaptureResult.DynCaptPadError: MessageBox.Show("signing device error"); break; default: MessageBox.Show("Unexpected error code "); break; } } }
private void BTN_SIGNREQ_Click(object sender, EventArgs e) { print("Request Sign"); SigCtl sigCtl = new SigCtl(); sigCtl.Licence = "AgAkAEy2cKydAQVXYWNvbQ1TaWduYXR1cmUgU0RLAgKBAgJkAACIAwEDZQA"; DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, name, clause, null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; sigObj.set_ExtraData("AdditionalData", "C# test: Additional data"); try { signdata = (string)sigObj.RenderBitmap("", 200, 150, "image/png", 1.4f, 0xff0000, 0xffffff, 10.0f, 10.0f, RBFlags.RenderOutputBase64 | RBFlags.RenderColor1BPP); signImage = Base64ToImage(signdata); PB_SIGIMAGE.Image = signImage; print("Sign Ok"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { print("Signature capture error res=" + (int)res + " ( " + res + " )"); switch (res) { case DynamicCaptureResult.DynCaptCancel: print("signature cancelled"); break; case DynamicCaptureResult.DynCaptError: print("no capture service available"); break; case DynamicCaptureResult.DynCaptPadError: print("signing device error"); break; default: print("Unexpected error code "); break; } } }
public void sign() { SigCtl sigCtl = new SigCtl(); DynamicCapture dc = new DynamicCapture(); DynamicCaptureResult res = dc.Capture(sigCtl, "Name", "Reason", null, null); if (res == DynamicCaptureResult.DynCaptOK) { SigObj sigObj = (SigObj)sigCtl.Signature; //sigObj.set_ExtraData("AdditionalData", "C# test: Additional data"); String filename = System.IO.Path.GetTempFileName(); try { sigObj.RenderBitmap(filename, 400, 200, "image/png", 0.7f, 0x000000, 0xffffff, 10.0f, 10.0f, RBFlags.RenderOutputFilename | RBFlags.RenderColor32BPP | RBFlags.RenderEncodeData | RBFlags.RenderBackgroundTransparent); Globals.ThisAddIn.Application.Selection.Range.InlineShapes.AddPicture(filename); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }