Question
Is there a way to check if there's a signature on the document?
Answer
There are no built-in methods specifically implemented for signature detection, but there's an approach that can be used to detect if the signature present on the document.
- Create a FlexiLayout, marking keywords that later can be used to precisely limit the area with the signature using the Region element.
Region - Map these regions to checkmark blocks.
Blocks- Export the FlexiLayout into a ".afl" file File > Export.
- Create a document definition based on created FlexiLayout in the FlexiCapture project (or add it as an additional layout to an existing document definition).
Creating a Document Definition based on a FlexiLayout - Create a script rule for each signature (checkmark). The script takes into account the number of filled dots in the area (blackness percentage) to set the value of the checkmark.
//C#
int threshold = 1;
IPictureObjectsInfo PictureObjectsInfo = Context.Field("Signature_M").Regions[0].Picture.AnalyzePageOjects(null);
Context.Field("Signature_M").Value = PictureObjectsInfo.BlacknessPercentage < threshold ? false : true;
The threshold value determines the percentage of the area that needs to be filled with the dots (1% in the example) and sets the value of the checkmark to a "checked" state if this value is exceeded and leaves it unchecked otherwise. This value depends on the documents and signatures that are processed and additional adjustments may be needed for the best results after the tests.
IPictureObjectsInfo
IField
Here are the results of the tests:
The downside of this method is that if scanned documents are of bad quality or the quality varies greatly between the samples (e.g. there are scanning marks in the signature area), this approach may not work correctly.
Comments
2 comments
Steffen Salomo
Hey Ihor, when i tried it i got an error that the index is out of bound.
The checkmark field doesnt check that this is a region field which mapped into it
Dmytro Bezus
Hello Steffen,
To avoid the index issue you could start the check if the region count is higher than 0:
If this isn't the case, you could create a ticket about it.
Kind regards,
Dmytro
Please sign in to leave a comment.