Skip to end of metadata
Go to start of metadata

Declaration

Delphi

function AddSignatureField(FieldName: WideString; Biodata: WideString; const Name, Reason, Location, Contact, AlternateName, Misc WideString;  showNameAndDate: WordBool):Integer;

ActiveX

HRESULT _stdcall AddSignatureField([in] BSTR FieldName, [in] BSTR Biodata, [in] BSTR Name, [in] BSTR Reason, [in] BSTR Location, [in] BSTR Contact, [in] BSTR AlternateName, [in] BSTR Misc, [in] VARIANT_BOOL ShowNameAndDate, [out, retval] long* RetVal); 

 

Description

By using this method you can add a signature to existing (empty) signature fields, which are already inside the document. Other than with AddSignature, you don´t need to define the positions, instead the signature is found by the field name. 

 AddSignatureField will force you to confirm the document hash on the device, to disable that you can enable the Emulation Mode (see Driver Options).


AddSignatureField required the 4 Callback Event (OnGetAesKeyOnGetDeviceCertificateOnGetSignedDocHashOnReadHighResBitmap). Without them adding a Signature into a PDF is not possible.



Arguments

ArgumentDescription
FieldName

FieldName is the Name of the signature field, in which the signature should be added.

Name

Name is the name of the signer. This is added to the signature details and the optional stamp.

Reason

Reason is the reason of signing and will also be added into the signature details and the stamp.

Location

Location is the loaction of signing. Signature details and stamp.

Contact

Contact is the contact of signing. This will also only be added to the signature details, but not to the stamp.

AlternateName

This value is for future use, use an empty string.

Misc

This value is for future use, use an empty string.

Biodata

Biodata is the biodata of the signature, which you can get from the freeware deviceAPI (GetBiodataString or peekBiodataString).

showNameAndDate

ShowNameAndDate is used to embed the stamp under the signature. It contains the name, reason and time and is visible in the document and also in the signature details.

 

 

Return value

AddSignatureField returns the following integer values:

ValueMeaning
-11

No key(s)*

-10

Seal required*

-3Signing will be repeated
-2Signing was cancelled
-1Signature was not added to the document, because of an error
0

Unspecified result

1

Signature was successful added to the document

*obsolete

 

 

Sample

C# - AddSignatureField
// Set device parameters
 
SignAPIv4.DeviceModel = SigDev.GetDriverString(0);
SignAPIv4.DeviceSerial = SigDev.GetDriverString(1); 
          
// Get biodata from device
             
string bd = "";

SigDev.peekBiodataString(ref bd);
            
// add the signature to the field "Unterschrift1" which already exist inside the PDF
 
string fieldName = "Unterschrift1";
string signer = "John Doe";
string reason = "I agree with the content.";
string location = "Stuttgart";
string contact = "John Doe";
string alternateName = "";
string misc = "";
bool showStamp = false;
 
int addResult = SignAPIv4.AddSignatureField(fieldName, bd, signer, reason, location, contact, alternateName, misc, showStamp);

 
switch(addResult)
{  
	case -11:	MessageBox.Show("No key(s).");
        		break;
                
	case -10: 	MessageBox.Show("Seal required.");
         		break;                     
       
 	case -3: 	MessageBox.Show("Repeat.");
         		break;    
              
 	case -2: 	MessageBox.Show("Cancelled.");			
         		break;                    
                
	case -1: 	MessageBox.Show("Error.");               
         		break;
                
	case 0: 	MessageBox.Show("Unspecified result.");                			
         		break;                      
                
 	case 1: 	MessageBox.Show("Succeeded.");                
         		break;
}
vb.NET - AddSignatureImage
'Set device parameters
'DeviceModel : This Property must be Set by the client application before calling AddSignature. 

SignatureAPI4.DeviceModel = SignatureDevice.GetDriverString(0)
SignatureAPI4.DeviceSerial = SignatureDevice.GetDriverString(1)  
 
'Get the biodata from the device
Dim bd,  As String = ""
SignatureDevice.peekBiodataString(bd)

addResult = SignatureAPI4.AddSignatureField(fieldName, bd, "Signer", "Reason", "Location", "Contact", "", "", True)
 
Select Case (addResult)

	Case -11
		MessageBox.Show("No key.")

	Case -10
		MessageBox.Show("Seal required.")

	Case -3
		MessageBox.Show("Repeat.")

	Case -2
		MessageBox.Show("Cancelled.")

	Case -1
		MessageBox.Show("Error.")

	Case 0
		MessageBox.Show("Unspecified result.")

	Case 1
		MessageBox.Show("Succeeded.")

End Select

 

 

  • No labels