Signature Field Selection Criteria
One key part while creating signatures of PDF documents using Web Trust is the selection of the fields where the signature will be placed in.
This can be done fairly simply by just selecting all signature fields, or it can be made more complex by selecting subsets of fields matching specific criteria.
Web Trust defines different ways to specify the selecting criteria while defining the documents inside the signature.
For each document, you can use one or a combination of the following properties:
signatureFieldsTypematches the type of the field in the PDF where the signature might end up.signatureFieldsNamematches the names of the fields in the PDF where the signature might end up.signatureFieldsMapmatches the key/value in the field definition object in the PDF where the signature might end up.failSignatureis a fallback in case there is no match.
Web Trust will respond with a 400 error if no criteria is matched and no failSignature is specified.
signatureFieldsType
This is the most relaxed criteria. Here you have three options:
signaturematches the signature Acrofields inside the PDF.textmatches the text Acrofields inside the PDF. In this case,compilemusn’t be true, otherwise you will get a 400 error. See PDF with forms for more details on the filling in forms and the parametercompile.undefinedmatches with nothing, and therefore this criteria fails.
FAILURE: When there is no match with the specified value or undefined.
IGNORED: This criteria is never ignored.
signatureFieldsName
For this criteria, you can specify an array of strings, each of which will try to be matched with the Acrofield names.
For instance, having [“signature1“, “signature2“] the system will search the Acrofields with name “signature1“ or “signature2“.
As you can see, for a field to satisfy this criteria, at least one of the signatureFieldsName must match with its name. So they are applied in OR.
FAILURE: When no field matches at least one string or [] is specified.
IGNORED: When it is undefined or not specified.
ATTENTION: Since the name is used to identified the signature fields whithin the PDF, each of the names assigned to signature fields must be unique. Otherwise, there is no error, but the signature will be applied on the last field sharing the same name.
signatureFieldsMap
It is a key-value map where the key will be tried to be matched with a name of a property of a PDF Acrofield and the value a possible value or values to be matched with the value of that property of the Acrofield.
The match is case-insensitive.
Once an Acrofield matches, its name will be automatically added to the signatureFieldsName array.
For instance, having {“prop1“: “value1“, “prop2“: undefined} the system will search Acrofields that contain the property prop1 with value value1 or that contain the property prop2 regardless the value. If the system finds one or more Acrofied matching this criteria, it will add their names to the signatureFieldsName array .
This criteria can be seen as some sort of preprocessing that can enrich the signatureFieldsName array.
FAILURE: There is no direct failure here; it depends on the FAILURE of signatureFieldsName.
IGNORED: When it is undefined or not specified.
failSignature
This property allows you to specify a signature position on the last page of the PDF in case of CRITERIA FAILURE.
CRITERIA FAILURE: When there is a FAILURE in signatureFieldsType or signatureFieldsName .
Note that the definition of CRITERIA FAILURE implies that both of the criteria are applied in AND logic.
The possible values of failSignature are: "TOP_LEFT" , "TOP_CENTER" , "TOP_RIGHT" , "BOTTOM_LEFT" , "BOTTOM_CENTER" , "BOTTOM_RIGHT" .
Always setting failSignature guarantees that there will be no 400 errors regarding criteria match.