Custom Signer Action Example (for Pronto version 3.5+ and ASP.NET)
ProntoOpenNet Thursday, April 23 2009This is an example of how collect data from the signer just before they sign and merge the data into the document all while still inside the Pronto automated signature request process. This example is written in .NET.
(For Classic ASP see this post)
This is the create transaction page
<%@ Page Language="VB" MasterPageFile="~/_Common/MasterPage.master" %> <%@ MasterType VirtualPath="~/_Common/MasterPage.master" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim t As New Pronto.Transaction() t.Account.Name = ConfigurationManager.AppSettings("Pronto_Account") t.Account.Password = ConfigurationManager.AppSettings("Pronto_Password") Dim doc As New Pronto.Document() doc.Title = "Test Document" doc.UserFileNameType = Pronto.Document.UserFileNameTypes.UseDocTitleSlashUserFileNamePlusSignerNamesPlusExtension doc.UserFileName = "Test_Document" doc.Source.Type = Pronto.Source.Types.Pdf_File_PageImage doc.Source.Data = Server.MapPath("Documents/Eula.pdf") Dim signer As New Pronto.Signer() signer.Name.FullName = "John Hancock" For i As Integer = 0 To 3 Dim sig As New Pronto.Signature() sig.Actions.Add("/Sign/” & ConfigurationManager.AppSettings("Pronto_Account") & “/Actions/AspNetAction.aspx", "AspNetActionExample") If i = 3 Then sig.ClientReturnUrl = "thanks.asp?a=4" Else sig.ClientReturnUrl = "thanks.asp?a=4&ps_loop=1" End If signer.Signatures.Add(sig) Next doc.Signers.Add(signer) t.Documents.Add(doc) If Request.QueryString("debug") = "true" Or Session("Debug") = "true" Then Session("Debug") = "true" t.Debug.Active = True End If t.Commit() If t.Error = "" Then lblResult.Text = "Your transaction submitted successfully. Return to the <a href=""../Admin/Default.aspx"">main menu</a>." Else lblResult.Text = t.ErrorFriendlyMessage End If If t.Debug.Active Then Master.DebugText = t.Debug.FormattedReturn End If End Sub </script> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Label ID="lblResult" runat="server" /> </asp:Content>
And here’s the Action Page:
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim ContainerText As String 'for removing the ContentPlaceHolder containerprefix: ctl00$ContentPlaceHolder1$ Dim FieldPrefixLength As Integer = 3 'for slicing off the field prefix: txt or rbl or cbx ContainerText = btnSubmit.ClientID.Replace(btnSubmit.ID, "") btnSubmit.PostBackUrl = "/prontosvr2/PdfFormSubmitHTMLPost.asp?containertext=" & ContainerText & "&fieldprefixlength=" & FieldPrefixLength & "&ps_actno=" & Request.QueryString("ps_actno") & "&ps_actstep=" & Request.QueryString("ps_actstep") & "&ps_enqs=" & Request.QueryString("ps_enqs") & "&ps_actstatus=4&SigID=" & Request.QueryString("sigid") & "&at=" & Request.QueryString("at") End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>ASP.NET Signer Action Example</title> <style type="text/css"> body {font-family:Arial;font-size:13px;} div {width:85px;float:left;margin:6px;text-align:right;font-weight:bold;} br {clear:both;} </style> </head> <body style="margin:13px;"> <form id="form1" runat="server"><br /> <h3>ASP.NET Signer Action Example</h3><br /> <input id="Hidden1" type="hidden" name="ProntoActionPostType" value="FormFields" /><%-- THIS HIDDEN FIELD IS REQUIRED --%> <div>First Name:</div> <asp:TextBox ID="txtFirstName" runat="server" Text="John"></asp:TextBox><br /> <div>Last Name:</div> <asp:TextBox ID="txtLastName" runat="server" Text="Smith"></asp:TextBox><br /> <div>Date of Birth:</div> <input id="txtDateOfBirth" name="txtDateOfBirth" type="text" value="1/1/1970" /><br /> <div> </div> <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> </form> </body> </html>