<% option explicit

 
Response.Buffer = true
 
Dim oTrans, sPDF, sReturn, bIsSuccessful, oProntoServer
 
sPDF = Server.MapPath("Eula.pdf") 'ADD PDF document to sPDF - this is the source document
 
Set oTrans = Server.CreateObject("ProntoOpen25.ProntoTransaction37") 'The object reference to the ProntoOpen.dll class is set
 
response.Write("<html><body style='font-family:sans-serif;'>")
response.write("<b>Here are the responses from the ProntoOpen function calls to set the transaction:</b><br /><br />")
 
bIsSuccessful = oTrans.CreateTransaction() '* CreateTransaction will initialized the transaction.
response.Write("CreateTransaction: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.SetAccount ("Default", "password", "", "", "", "", "") 'SetAccount requires authentication information linked to the Account table in the PRONTO database.
response.Write("SetAccount: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.SetResponse ("http", "") 'SetResponse is how you define the method of response to the ProntoSend POST 'http' it a simple POST response to the ProntoSend method and is the normal method used (no others are implemented yet).
response.Write("SetResponse: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.SetReturn ("none", "")' SetReturn is how you define the method of returning all documents that are a part of the transaction back to the transaction creator.
response.Write("SetReturn: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.SetJurisdiction ("US", "TX", "us-esign")' SetJurisdiction may be supported in future released (beyond version 2) It is shown here for illustration only and is not required to create a transaction.
response.Write("SetJurisdiction: " & bIsSuccessful & "<br>")
 
' Now that transaction level data has been set, we must create a document
' reference and under that, one or more signers.
 
bIsSuccessful = oTrans.AddDocument ("sign", "seq")' AddDocument creates a new document to sign. 
response.Write("AddDocument: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddSource (sPDF, "pdf-file")' The PDF source of the new document. If the second argument is 'inline', then the string sPDF must contain the valid HTML document to sign
response.Write("AddSource: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddDocumentField ("MyPDFFieldName1", "My Data To Be Inserted Into The Field")' AddDocumentField inserts data into PDF form fields. 
response.Write("AddDocumentField1: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddDocumentField ("MyPDFFieldName2", "More data To Be Inserted Into The Field")
response.Write("AddDocumentField2: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddDocumentField ("MyPDFFieldName3", "Do as many of these as you'd like")
response.Write("AddDocumentField3: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddSigner ("", "query", "yes", "", "query", "yes", _
    "", "query", "yes", "", "query", "yes", "url", "organization", _
    "server", "standard", "none", "", "email", "yes", _
    request.ServerVariables("HTTP_HOST") & "prontodemo/softwarelicense/thanks1.asp?a=2", _
    "no", "US", "TX", "", "", "", "yes")' AddSigner adds signer information to the document created above. AddSigner has numerous parameters. Refer to the PRONTO Server reference documentation for a complete description.
response.Write("AddSigner: " & bIsSuccessful & "<br>")
 
bIsSuccessful = oTrans.AddSignerXData (1,54,144)'Additional data needed to place signer info and three optional text fields on to PDF page. See documentation for more information
response.Write("AddSignerXData: " & bIsSuccessful & "<br>")
 
' ProntoSend sends the XML document to the PRONTO Server for processing
' and receives the response from PRONTO Server.
' Enter fully qualified URL to the PRONTO server
' as first argument and timeout in seconds as the second argument
 
set oProntoServer = Server.CreateObject("ProntoServ25.ServXMLHTTP25")
if (oProntoServer is Nothing) then 'See if can load XML directly to local PRONTO Server
  err.Clear 
  sReturn = oTrans.ProntoSend (sBaseInternalUrl & "prontosvr2/ProntoXML.asp", 30)
else
  sReturn = oProntoServer.OpenTransaction(oTrans.GetXML())
  Set oProntoServer = Nothing
End if
Response.Write("<br>") 
Response.Write("<b>Here is the response from PRONTO Server:</b><br /><br />" & Replace(sReturn,";",";<br>")) 'Create the response
Response.Write("<br>") 
Response.Write("<b>Here is the XML that was posted to PRONTO Server that returns the response shown above:</b><br>" & Entity(oTrans.GetXML())) 'Get the XML for display
 
Response.Write("</body></html>")
 
Response.End
 
' This is a utility function that parses the XML data for pretty print
' display
 
Function Entity(sData)
    Dim sData1, sChar, i, b
    b = false
 
    for i = 1 to len(sData)
   sChar = mid(sData,i,1)
   Select Case sChar
   Case "<"
   sData1 = sData1 & "<span style='color: blue;'><BR>"
   sData1 = sData1 & "&lt;"
   Case ">"
   sData1 = sData1 & "&gt;</span>"
   Case chr(&h21)
   sData1 = sData1 & "&#x21;"
   Case chr(&h22)
   if b = false then
   sData1 = sData1 & "&#x22;<span style='color: red;'>"
   b = True
   else
   sData1 = sData1 & "</span>&#x22;"
   b = false
   end if
   Case chr(&h3f)
   sData1 = sData1 & "&#x3f;"
   'Case chr(&h0d)
   ' sData1 = sData1 & "<BR>"
   ' i=i+1
   case else
   sData1 = sData1 & sChar
   end select
    Next
 
    Entity = sData1
    
end Function
 
' This is a utility function that parses the ProntoSend XML Response
' from the PRONTO Server.
'
Function ParseResponse(sResponse)
    ParseResponse = sResponse
 
    Dim s1, s2, s3, i
    s1 = cstr(sResponse)
    for i= 1 to len(s1)
        s3 = mid(s1,i,1)
        if s3=";" then
       s2=s2 & s3 & "<BR>"
        else
       s2=s2 & s3
        end if
    next
    ParseResponse = s2
 
End Function
 %>