Rust
Rust
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 Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let pdf = chilkat::Pdf::new();
// Load a PDF containing 2 remaining unsigned signature fields:
if pdf.load_file("qa_data/pdf/doctor_patient_parent.pdf").is_err() {
println!("{}", pdf.last_error_text());
return;
}
// Note: This example requires Chilkat v9.5.0.90 or greater.
let json = chilkat::JsonObject::new();
let _ = pdf.get_unsigned_sig_fields(&json);
json.set_emit_compact(false);
println!("{}", json.emit().unwrap_or_default());
// Result:
// {
// "unsignedSigField": [
// "doctor_signature",
// "parent_signature"
// ]
// }
// To iterate over the field names:
let mut str_val = String::new();
let mut i = 0;
let count_i = json.size_of_array("unsignedSigField");
while i < count_i {
json.set_i(i);
str_val = json.string_of("unsignedSigField[i]").unwrap_or_default();
println!("{}", str_val);
i = i + 1;
}