Sample code for 30+ languages & platforms
Lua Requires Chilkat v9.5.0.90+

PDF List Unsigned Signature Fields

See more PDF Signatures Examples

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

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

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

local pdf = chilkat.Pdf.new()

-- Load a PDF containing 2 remaining unsigned signature fields:
local success = pdf:load_file("qa_data/pdf/doctor_patient_parent.pdf")
if not success then
    print(pdf.last_error_text)
    return
end

local json = chilkat.JsonObject.new()
pdf:get_unsigned_sig_fields(json)

json.emit_compact = false
print(json:emit())

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

-- To iterate over the field names:
local strVal = ""

local i = 0
local count_i = json:size_of_array("unsignedSigField")
while i < count_i do
    json.i = i
    strVal = json:string_of("unsignedSigField[i]")
    print(strVal)
    i = i + 1
end