doc.isModified() returns true after a document is created, only

Using the Android ‘PDFNetAndroid-’ SDK

I am attempting to distinguish when a document has been modified so that I can prompt the user to save on exit. I am finding that doc.isModified() returns true immediately after being created:

PDFDoc doc = new PDFDoc();

if(doc != null) {

Log.d(TAG, "IS DOC MODIFIED: " + doc.isModified());


Log Contents:


Is there a reason it returns true prior to any modifications to the actual document? Is there a way to tell when the document has been modified through the API?

Thanks in advance.


When a document is loaded by PDFNet it might have to repair the document. This is why IsModified may return true before you do anything.

Here is how you can test for a repaired file


PDFDoc doc = new PDFDoc(path);

m_repaired = doc.IsModified(); // call before anything else


It is probably best to track your own variable for user made changes, and only prompt for save if user made a change themselves. This how typical PDF reader apps work.