@Test
public void indexOfPageFromOutlineDestination() throws IOException
{

    doc = PDDocument.load(TestPDPageTree.class.getResourceAsStream("/pdfbox/com/tom_roush/pdfbox/pdmodel/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)));
        }
    }
}