loadDocumentTemplateBuffer static method

void loadDocumentTemplateBuffer(
  1. Uint8List? buffer
)

Loads a document template from a data buffer.

param buffer A buffer containing the document template data. throws DocumentException An error has occurred during Document Library execution.

Implementation

static void loadDocumentTemplateBuffer(Uint8List? buffer) {
  Pointer<UnsignedChar>? pBuffer;
  if (buffer != null) {
  	pBuffer = calloc.allocate<UnsignedChar>(buffer.length);
  	pBuffer.cast<Uint8>().asTypedList(buffer.length).setAll(0, buffer);
  }
  try {
    var err = documentSDK.id3DocumentLibrary_LoadDocumentTemplateBuffer(pBuffer ?? nullptr, buffer?.length ?? 0);
    if (err != DocumentError.success.value) {
      throw DocumentException(err);
    }
  } finally {
    if (pBuffer != null) {
      calloc.free(pBuffer);
    }
  }
}