Why are my text field appearances inconsistent after flattening?


I have a document with some text fields that were already populated in Acrobat. When I add new field values in PDFNet, then flatten the document, the text fields have slight differences (in, for example, indentation). How can I avoid this?


Because the document contains a mixture of appearance streams created by Acrobat and by PDFNet, and because Acrobat and PDFNet generate slightly different appearances, there will be inconsistencies if appearances are added first with one application and then the other.

You can work around this by deleting existing appearance streams prior to flattening, like so:

FieldIterator itr;
for (itr=doc.GetFieldIterator(); itr.HasNext(); itr.Next())
Field field = itr.Current();
if (field.GetType() == Field::Type::e_text)