destAcroForm.setFields(destFields);
}
Iterator srcFieldsIterator = srcFields.iterator();
while (srcFieldsIterator.hasNext())
{
PDField srcField = (PDField) srcFieldsIterator.next();
PDField destField = PDFieldFactory.createField(destAcroForm,
(COSDictionary) cloner.cloneForNewDocument(srcField.getDictionary()));
// if the form already has a field with this name then we need to rename this field
// to prevent merge conflicts.
if (destAcroForm.getField(destField.getFullyQualifiedName()) != null)
{
destField.setPartialName("dummyFieldName" + (nextFieldNum++));
}
destFields.add(destField);
}
}
}