list_signature_fields enumerates the signature fields already in a PDF — empty slots and
already-signed ones — to drive a UI, or to pick a named empty field for
sign_existing_field. See Existing Fields & Seed
Values for the walkthrough.
Lists every AcroForm field with /FT /Sig in input, following the AcroForm /Fields array order.
use mudrit_pdfsign::list_signature_fields;let pdf = std::fs::read("template.pdf").unwrap();for f in list_signature_fields(pdf)? { println!("{} — page {} — {}", f.name, f.page, if f.signed { "signed" } else { "empty" });}# Ok::<(), mudrit_pdfsign::Error>(())
For an encrypted input, pass the open password on the PdfReader so
the field names can be read: list_signature_fields(PdfReader::open("locked.pdf")?.password("asd")).