getPagesCount method

int getPagesCount(
  1. String inputPdfFilePath, {
  2. Allocator allocator = calloc,
})

Implementation

int getPagesCount(String inputPdfFilePath,
    {ffi.Allocator allocator = calloc}) {
  var uriPointer = stringToNativeInt8(inputPdfFilePath, allocator: allocator);
  try {
    var result = pdfTextExtractionBindings!.getPagesCount(
        uriPointer,
        ffi.Pointer.fromFunction<
            ffi.Int32 Function(
          ffi.Pointer<ffi.Int8>,
        )>(_logCallback, except));

    if (result != -1) {
      return result;
    } else {
      throw Exception('Error on PDF pages count: $_lastError');
    }
  } catch (e) {
    rethrow;
  } finally {
    allocator.free(uriPointer);
  }
}