List<PDPage> pages = srcCatalog.getAllPages();
Iterator<PDPage> pageIter = pages.iterator();
HashMap<COSDictionary, COSDictionary> objMapping = new HashMap<COSDictionary, COSDictionary>();
while (pageIter.hasNext())
{
PDPage page = pageIter.next();
PDPage newPage = new PDPage((COSDictionary) cloner.cloneForNewDocument(page.getCOSDictionary()));
newPage.setCropBox(page.findCropBox());
newPage.setMediaBox(page.findMediaBox());
newPage.setRotation(page.findRotation());
if (mergeStructTree)
{
updateStructParentEntries(newPage, destParentTreeNextKey);
objMapping.put(page.getCOSDictionary(), newPage.getCOSDictionary());
List<PDAnnotation> oldAnnots = page.getAnnotations();
List<PDAnnotation> newAnnots = newPage.getAnnotations();
for (int i = 0; i < oldAnnots.size(); i++)
{
objMapping.put(oldAnnots.get(i).getDictionary(), newAnnots.get(i).getDictionary());
}
// TODO update mapping for XObjects