Not able to refresh all field appearances sometimes

35 views
Skip to first unread message

Ryan

unread,
Nov 18, 2015, 1:32:12 PM11/18/15
to PDFTron PDFNet SDK
Q:

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

----------------------------------------------------------------------

A:

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(); itr.next()) {
   
try {
       
Field field = itr.current();
       
if(field.IsValid()) { field.RefreshAppearance(); }
   
} catch(Exception e) {
       
// ignore...
   
}
}



Reply all
Reply to author
Forward
0 new messages