PdfPages extends PdfObjectWrapper<PdfDictionary> { public void addPage(PdfDictionary page) { kids.add(page); incrementCount(); page.put(PdfName.Parent, getPdfObject()); page.setModified(); } PdfPages(int from, PdfDocument pdfDocument, PdfPages parent);  PdfPages(int from, PdfDocument pdfDocument);  PdfPages(int from, int maxCount, PdfDictionary pdfObject, PdfPages parent); void addPage(PdfDictionary page); boolean addPage(int index, PdfPage pdfPage); boolean removePage(int pageNum); void addPages(PdfPages pdfPages); void removeFromParent(); int getFrom(); int getCount(); void correctFrom(int correction); PdfArray getKids(); PdfPages getParent(); void incrementCount(); void decrementCount(); int compareTo(int index);  }
@Test public void reversePagesTest() throws IOException { String filename = "reversePagesTest.pdf"; int pageCount = 111; PdfDocument pdfDoc = new PdfDocument(new PdfWriter(destinationFolder + filename)); for (int i = pageCount; i > 0; i--) { PdfPage page = new PdfPage(pdfDoc, pdfDoc.getDefaultPageSize()); pdfDoc.addPage(1, page); page.getPdfObject().put(PageNum, new PdfNumber(i)); page.flush(); } pdfDoc.close(); verifyPagesOrder(destinationFolder + filename, pageCount); }