Sample code for 30+ languages & platforms
Dart

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 Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

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

  final pdf = CkPdf();

  // Load a PDF containing 2 remaining unsigned signature fields:
  try {
    pdf.loadFile('qa_data/pdf/doctor_patient_parent.pdf');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Note: This example requires Chilkat v9.5.0.90 or greater.
  final json = CkJsonObject();
  pdf.getUnsignedSigFields(json);

  json.emitCompact = false;
  print(json.emit());

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

  // To iterate over the field names:
  var strVal = '';

  var i = 0;
  final countI = json.sizeOfArray('unsignedSigField');
  while (i < countI) {
    json.i = i;
    strVal = json.stringOf('unsignedSigField[i]');
    print(strVal);
    i++;
  }
}