@Test
public void copyStreamInArrayIsSanitized() throws IOException {

    try (PDDocument document = PDFParser.parse(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getClassLoader().getResourceAsStream("pdf/annots_in_contents_array_stream.pdf")))) {
        PDPage page = document.getPage(0);
        assertNotNull(page.getCOSObject().getDictionaryObject(COSName.CONTENTS, COSArray.class)
                .getObject(0, COSStream.class).getItem(COSName.ANNOTS));
        PDPage copy = new PageCopier(false).copyOf(page);
        assertNull(copy.getCOSObject().getDictionaryObject(COSName.CONTENTS, COSArray.class)
                .getObject(0, COSStream.class).getItem(COSName.ANNOTS));
    }
}