/** * Copies page to the specified document. * <br><br> * NOTE: Works only for pages from the document opened in reading mode, otherwise an exception is thrown. * * @param toDocument a document to copy page to. * @return copied {@link PdfPage}. */ public PdfPage copyTo(PdfDocument toDocument) { return copyTo(toDocument, null); }
for (Integer pageNum : pagesToCopy) { PdfPage page = getPage((int) pageNum); PdfPage newPage = page.copyTo(toDocument, copier); copiedPages.add(newPage); page2page.put(page, newPage);