@Test
public void nextPage() throws TaskIOException, TaskPermissionsException, IOException {

    try (PdfMixFragment victim = PdfMixFragment.newInstance(new PdfMixInput(PdfStreamSource.newInstanceNoPassword(
            getClass().getClassLoader().getResourceAsStream("pdf/2_pages.pdf"), "test.pdf")))) {
        assertTrue(victim.hasNextPage());
        assertThat(new PdfTextExtractorByArea()
                .extractTextFromArea(victim.nextPage(), new Rectangle(54, 56, 60, 21)).trim(), is("First page"));
        assertTrue(victim.hasNextPage());
        assertThat(new PdfTextExtractorByArea()
                .extractTextFromArea(victim.nextPage(), new Rectangle(54, 56, 60, 21)).trim(), is("Second page"));
        assertFalse(victim.hasNextPage());
    }
}