getLicenseFileSerial static method

String getLicenseFileSerial()

Retrieves the serial number of the previously loaded license.

return The license serial number. throws DocumentException An error has occurred during Document Library execution.

Implementation

static String getLicenseFileSerial() {
  Pointer<Char> pLicenseFileSerial = calloc.allocate(256);
  Pointer<Int> pLicenseFileSerialSize = calloc.allocate(1);
  pLicenseFileSerialSize[0] = 256;
  try {
    var err = documentSDK.id3DocumentLicense_GetLicenseFileSerial(pLicenseFileSerial, pLicenseFileSerialSize);
    if (err == DocumentError.insufficientBuffer.value) {
      calloc.free(pLicenseFileSerial);
      pLicenseFileSerial = calloc.allocate(pLicenseFileSerialSize.value);
      err = documentSDK.id3DocumentLicense_GetLicenseFileSerial(pLicenseFileSerial, pLicenseFileSerialSize);
      if (err != DocumentError.success.value) {
        throw DocumentException(err);
      }
    }
    final vLicenseFileSerial = utf8.decode(Uint8List.fromList(pLicenseFileSerial.cast<Uint8>().asTypedList(pLicenseFileSerialSize.value)));
    return vLicenseFileSerial;
  } finally {
    calloc.free(pLicenseFileSerial);
    calloc.free(pLicenseFileSerialSize);
  }
}