Sample code for 30+ languages & platforms
Xbase++

PDF List Unsigned Signature Fields

See more PDF Signatures Examples

Demonstrates how to list the unsigned signature fields in a PDF.

Note: This example requires Chilkat v9.5.0.90 or greater.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oPdf
LOCAL oJson
LOCAL cStrVal
LOCAL i
LOCAL nCount_i

nSuccess := 0

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oPdf := CreateObject("Chilkat.Pdf")

//  Load a PDF containing 2 remaining unsigned signature fields:
nSuccess := oPdf:LoadFile("qa_data/pdf/doctor_patient_parent.pdf")
IF (nSuccess == 0)
    ? oPdf:LastErrorText
    oPdf:destroy()
    RETURN
ENDIF

//  Note: This example requires Chilkat v9.5.0.90 or greater.
oJson := CreateObject("Chilkat.JsonObject")
oPdf:GetUnsignedSigFields(oJson)

oJson:EmitCompact := 0
? oJson:Emit()

//  Result:
//  {
//    "unsignedSigField": [
//      "doctor_signature",
//      "parent_signature"
//    ]
//  }

//  To iterate over the field names:

i := 0
nCount_i := oJson:SizeOfArray("unsignedSigField")
DO WHILE i < nCount_i
    oJson:I := i
    cStrVal := oJson:StringOf("unsignedSigField[i]")
    ? cStrVal
    i := i + 1
ENDDO

oPdf:destroy()
oJson:destroy()