Free Support Forum - aspose.com

Version 6 - Signature Fields - Aspose.Pdf.Facades.Form - GetFieldType returns Invalid Name or Type

Just upgraded from ASPOSE.PDF.KIT to ASPOSE.PDF - my previously working Digital Signature functionality is not working now.

Note, I'm using (and was previously using) Live Cycle created documents (XFA docs)

Problems:

(1) GetFieldType on a Signature field is returning FieldType.InvalidNameOrType

(2) PDFFileSignature.Sign() is failing. Error Msg is "Signature Field 'Signature_Instructor[0]' " is not defined. Strangely, I passed in the fully decorated name of the signature fieldname (form[0].subform[0]....Signature_Instructor[0]), but the error message only reported back the tail of that fieldname (Signature_Instructor[0]).Dim oPFX As New Aspose.Pdf.InteractiveFeatures.Forms.PKCS1(fnPFX, password)oSig.Sign(fieldname, oPFX)

Hello Gregg,

Thanks for using our products.

Can you please share the resource files and the code snippet that you are using so that we can test the scenario at our end. We apologize for your inconvenience.

For this test, I created a PDF form in Acrobat that contains a single field - a Signature Field named Signature1 (attached)

Here's the code...

Dim oForm1 As New Aspose.Pdf.Facades.Form("c:\temp\gss1SignatureAcrobat.pdf")
Dim oFieldType As Facades.FieldType = oForm1.GetFieldType("Signature1")

The result is:

oFieldType is set to FieldType.InvalidNameOrType
I would have expected it to be set to FieldType.Signature

And, the even larger problem is that code that digitally signed the field, that worked in ASPOSE.PDF.KIT is NOT working w/ ASPOSE.PDF v6.0 !!!

Signing an existing Signature Field in a LiveCycle created PDF does not work...

For this test, I created (in LiveCycle) a form with a Signature Field (attached).

Following is the code snippet I use to try to sign the form:

dim fnIn = "C:\temp\gss1SignatureLiveCycle.pdf"
dim fnOut = "C:\temp\gssOut.pdf"
dim fnPFX = "C:\temp\gss.pfx"
dim password = "123456"
dim fieldname = "form1[0].#subform[0].SignatureField1[0]: form1[0].#subform[0].SignatureField1[0]"

' Step 1 - ensure that the specified field name exists in the PDF
Dim oForm1 As New Aspose.Pdf.Facades.Form(fnIn)
dim fieldNameReadback = oForm1.GetFullFieldName(fieldname)
If (fieldNameReadback = "") Then
' field name not found
return
end if

' Step 2 - sign the PDF file at the specified fieldname

Dim oSig As New PdfFileSignature(fnIn, fnOut)
Dim oPFX As New Aspose.Pdf.InteractiveFeatures.Forms.PKCS1(fnPFX, password)
oPFX.Reason = "Testing"
oSig.Sign(fieldname, oPFX) ' <--- fails here
oSig.Save()

The .Sign() method fails with the exception message:

The name 'form1[0].#subform[0].SignatureField1[0]: form1[0].#subform[0].SignatureField1[0]' doesn't represent valid signature field or signature field is not empty.

End If