Question:
After merging XFDF file containing annotations, the new annotations do not appear in Chrome browser.
Answer:
The Chrome PDF viewer will not generate default appearances for annotations that are missing an explicit one. The following code will run through all the annotations, and generate appearances for those that are missing them. Hopefully a future addition of Chrome PDF viewer will be able to generate these as most other PDF readers do.
PageIterator itr = doc.GetPageIterator();
for (; itr.HasNext(); itr.Next())
{
System.Console.WriteLine("Page {0:d}: ", itr.GetPageNumber());
Page page = itr.Current();
int num_annots = page.GetNumAnnots();
for (int i=0; i<num_annots; ++i)
{
Annot annot = page.GetAnnot(i);
if (annot.IsValid() == false) continue;
if (annot.GetAppearance() == null) annot.RefreshAppearance();
}
}