Not able to refresh all field appearances sometimes


When I call PDFDoc.RefreshFieldAppearances it throws an exception on some PDF files. How do I refresh the appearance of all fields?


This is caused by malformed (non-conforming) PDF files, which are throwing various errors.

The following code will allow you to traverse all the fields, ignoring any bad ones.

for(FieldIterator itr = pdfdoc.getFieldIterator(); itr.hasNext(); { try { Field field = itr.current(); if(field.IsValid()) { field.RefreshAppearance(); } } catch(Exception e) { // ignore... } }