public PDPageLabels getPageLabels() throws IOException
    {
        COSDictionary dict = root.getCOSDictionary(COSName.PAGE_LABELS);
        return dict == null ? null : new PDPageLabels(document, dict);
    }
@Test
    void retrievePageLabelsOnMalformedPdf() throws IOException
    {
        try (PDDocument doc = Loader
                .loadPDF(RandomAccessReadBuffer.createBufferFromStream(
                        TestPDDocumentCatalog.class.getResourceAsStream("badpagelabels.pdf"))))
        {
            PDDocumentCatalog cat = doc.getDocumentCatalog();
            // getLabelsByPageIndices() should not throw an exception
            cat.getPageLabels().getLabelsByPageIndices();
        }
    }