@Test
public void retrievePageLabels() throws IOException
{

    PDDocument doc = null;
    try
    {
        doc = PDDocument.load(TestPDDocumentCatalog.class.getResourceAsStream("/pdfbox/com/tom_roush/pdfbox/pdmodel/test_pagelabels.pdf"));
        PDDocumentCatalog cat = doc.getDocumentCatalog();
        String[] labels = cat.getPageLabels().getLabelsByPageIndices();
        assertEquals(12, labels.length);
        assertEquals("A1", labels[0]);
        assertEquals("A2", labels[1]);
        assertEquals("A3", labels[2]);
        assertEquals("i", labels[3]);
        assertEquals("ii", labels[4]);
        assertEquals("iii", labels[5]);
        assertEquals("iv", labels[6]);
        assertEquals("v", labels[7]);
        assertEquals("vi", labels[8]);
        assertEquals("vii", labels[9]);
        assertEquals("Appendix I", labels[10]);
        assertEquals("Appendix II", labels[11]);
    }
    finally
    {
        if(doc != null)
        {
            doc.close();
        }
    }
}