indexOf method

int indexOf(
  1. PdfPage page
)

Gets the index of the page.

Implementation

int indexOf(PdfPage page) {
  if (PdfDocumentHelper.getHelper(_helper.document!).isLoadedDocument) {
    int index = -1;
    final int count = this.count;
    for (int i = 0; i < count; i++) {
      final PdfPage? p = _returnValue(i);
      if (p == page) {
        index = i;
        break;
      }
    }
    return index;
  } else if (_helper._section != null) {
    return PdfSectionHelper.getHelper(_helper._section!).indexOf(page);
  } else {
    int index = -1;
    int numPages = 0;
    for (int i = 0; i < _helper.document!.sections!.count; i++) {
      final PdfSection section = _helper.document!.sections![i];
      index = PdfSectionHelper.getHelper(section).indexOf(page);
      if (index >= 0) {
        index += numPages;
        break;
      }
      numPages += PdfSectionHelper.getHelper(section).count;
    }
    return index;
  }
}