Why are my text field appearances inconsistent after flattening?

46 views
Skip to first unread message

Aaron

unread,
Jul 28, 2014, 3:45:14 PM7/28/14
to pdfne...@googlegroups.com
Q:

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?

------
A:

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)
    {
        field.GetSDFObj().Erase("AP");
    }
}

doc.FlattenAnnotations();


Reply all
Reply to author
Forward
0 new messages