Unable to read the signature field

已查看 48 次
跳至第一个未读帖子

Karthi Keyan

未读,
2021年2月19日 14:25:322021/2/19
收件人 PDFTron SDK
Hi All, 

I'm facing an issue like I was not able to read the signature field value using PDFTron python SDK. 

Signature field 

Screenshot from 2021-02-12 09-46-58.png

When I click sign here, it pops up a window where I can draw, type or upload my signature image.
Screenshot from 2021-02-12 09-47-13.png
If I click create, then the value occurs there. 

Screenshot from 2021-02-12 09-47-30.png


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
Karthikeyan B

Ryan

未读,
2021年2月19日 14:29:432021/2/19
收件人 PDFTron SDK
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.

Karthi Keyan

未读,
2021年3月5日 12:34:222021/3/5
收件人 PDFTron SDK on behalf of Ryan
Hi Ryan, 

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()
    while itr.HasNext():
        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()

            while page_itr.HasNext():
                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():
                        continue

                    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
                           sig_widget_rect.Contains(ink_rect.x2, ink_rect.y2)):
                        signature_found = True    

                    i = i + 1
                page_itr.Next()


            print()
            if signature_found:
                print("Signature found")
            else:
                print("No signature found")

            print("------------------------------")
        itr.Next()


I'm attaching the sample pdf for your reference

Best Regards,

 Karthikeyan (IT dept)


--
You received this message because you are subscribed to the "PDFTron PDFNet SDK" group (http://www.pdftron.com/pdfnet/forum.html).
---
You received this message because you are subscribed to the Google Groups "PDFTron SDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-sdk+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdfnet-sdk/829a4371-9881-4bed-8719-a5b8d55f4ed8n%40googlegroups.com.
contract_sign.pdf

Ryan

未读,
2021年3月8日 12:40:482021/3/8
收件人 PDFTron SDK
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.
回复全部
回复作者
转发
0 个新帖子