@Test public void removePageWithFormFieldsTest() throws IOException { String filename = sourceFolder + "docWithFields.pdf"; PdfDocument pdfDoc = new PdfDocument(new PdfReader(filename)); pdfDoc.removePage(1); PdfArray fields = pdfDoc.getCatalog().getPdfObject().getAsDictionary(PdfName.AcroForm) .getAsArray(PdfName.Fields); PdfDictionary field = (PdfDictionary) fields.get(0); PdfDictionary kid = (PdfDictionary) field.getAsArray(PdfName.Kids).get(0); Assert.assertEquals(6, kid.keySet().size()); Assert.assertEquals(3, fields.size()); pdfDoc.close(); }
public boolean removePage(int pageNum) { if (pageNum < from || pageNum >= from + getCount()) return false; decrementCount(); kids.remove(pageNum - from); return true; }
PdfPages extends PdfObjectWrapper<PdfDictionary> { public boolean removePage(int pageNum) { if (pageNum < from || pageNum >= from + getCount()) return false; decrementCount(); kids.remove(pageNum - from); return true; } }
PdfPages extends PdfObjectWrapper<PdfDictionary> { public boolean removePage(int pageNum) { if (pageNum < from || pageNum >= from + getCount()) return false; decrementCount(); kids.remove(pageNum - from); return true; } PdfPages(int from, PdfDocument pdfDocument, PdfPages parent);  PdfPages(int from, PdfDocument pdfDocument);  PdfPages(int from, int maxCount, PdfDictionary pdfObject, PdfPages parent); }
PdfPages extends PdfObjectWrapper<PdfDictionary> { public boolean removePage(int pageNum) { if (pageNum < from || pageNum >= from + getCount()) return false; decrementCount(); kids.remove(pageNum - from); return true; } 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); }
PdfPages extends PdfObjectWrapper<PdfDictionary> { public boolean removePage(int pageNum) { if (pageNum < from || pageNum >= from + getCount()) return false; decrementCount(); kids.remove(pageNum - from); return true; } 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);  }