I’m facing an issue like I was not able to read the signature field value using PDFTron python SDK.
When I click sign here, it pops up a window where I can draw, type or upload my signature image.
If I click create, then the value occurs there.
So in python code, I was reading the signature field and checked the type of field.
Trying to get the value of the field using the code
field_value = field.GetValue()
And also i create using field_value = field.GetValueAsString()
But I’m getting a null value from that.
Seeking your help folks, Help me.
Thanks in advance
If you added the signature using WebViewer, then the signature is actually added over top of the Digital Signature field with a Freehand/Ink annotation.
You can track the bounding boxes of the signature field, and look for an Ink annotation that has the same bounding box.
See this sample code on how to iterate Ink annots.
I tried the approach but it’s working for text or image upload, not for drawing.
Here is the code which I’m trying.
itr = doc.GetFieldIterator()
if itr.Current().GetType() == Field.e_signature and itr.Current().IsAnnot():
signature_found = False
print("Signature field name: " + itr.Current().GetName())
print("Traversing all annotations in the document...")
page_num = 1
page_itr = doc.GetPageIterator()
sig_widget = Annot(itr.Current().GetSDFObj())
sig_widget_rect = sig_widget.GetRect()
page_num = page_num + 1
page = page_itr.Current()
num_annots = page.GetNumAnnots()
i = 0
while i < num_annots:
annot = page.GetAnnot(i)
if not annot.IsValid():
if annot.GetType() == Annot.e_Ink or annot.GetType() == Annot.e_Stamp:
ink_rect = annot.GetRect()
if (sig_widget_rect.Contains(ink_rect.x1, ink_rect.y1) or
sig_widget_rect.Contains(ink_rect.x1, ink_rect.y2) or
sig_widget_rect.Contains(ink_rect.x2, ink_rect.y1) or
signature_found = True
i = i + 1
print("No signature found")
contract_sign.pdf (32.8 KB)
Sorry, its unclear what you are describing now.
Could you please elaborate on exactly what you get, and what you expected to get instead, with regards to the code you provided and the corresponding PDF.