public int indexOf(PDPage page)
    {
        SearchContext context = new SearchContext(page);
        if (findPage(context, root))
        {
            return context.index;
        }
        return -1;
    }
@Test
    void indexOfPageFromOutlineDestination() throws IOException
    {
        doc = Loader.loadPDF(RandomAccessReadBuffer.createBufferFromStream(
                TestPDPageTree.class.getResourceAsStream("with_outline.pdf")));
        PDDocumentOutline outline = doc.getDocumentCatalog().getDocumentOutline();
        for (PDOutlineItem current : outline.children())
        {
            if (current.getTitle().contains("Second"))
            {
                assertEquals(2, doc.getPages().indexOf(current.findDestinationPage(doc)));
            }
        }
    }