Annotations do not appear when viewing PDF in Chrome


After merging XFDF file containing annotations, the new annotations do not appear in Chrome browser.


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();

As of PDFNet 8.0 there is a single API call you can make now after calling FDFMerge that will take care of generating appearances only for those annotations that need it.