@Override
    public Iterator<COSBase> iterator()
    {
        return getObjects().iterator();
    }
@Test
    void testSubsetting() throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        try (PDDocument document = new PDDocument())
        {
            PDPage page = new PDPage(PDRectangle.A4);
            document.addPage(page);
            document.save(baos);
        }

        try (PDDocument document = Loader.loadPDF(baos.toByteArray()))
        {
            PDPage page = document.getPage(0);

            PDFont font = PDType0Font.load(document, TestCOSIncrement.class.getResourceAsStream(
                    "/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"));

            try (PDPageContentStream contentStream = new PDPageContentStream(document, page))
            {
                contentStream.beginText();
                contentStream.setFont(font, 12);
                contentStream.newLineAtOffset(75, 750);
                contentStream.showText("Apache PDFBox");
                contentStream.endText();
            }

            COSDictionary catalog = document.getDocumentCatalog().getCOSObject();
            catalog.setNeedToBeUpdated(true);
            COSDictionary pages = catalog.getCOSDictionary(COSName.PAGES);
            pages.setNeedToBeUpdated(true);
            page.getCOSObject().setNeedToBeUpdated(true);

            document.saveIncremental(new FileOutputStream("target/test-output/PDFBOX-5627.pdf"));
        }

        try (PDDocument document = Loader.loadPDF(new File("target/test-output/PDFBOX-5627.pdf")))
        {
            PDPage page = document.getPage(0);
            COSName fontName = page.getResources().getFontNames().iterator().next();
            PDFont font = page.getResources().getFont(fontName);
            assertTrue(font.isEmbedded());
        }
    }