Why do I get an exception in ElementReader.Next()?

Q: I get the following exception:

Exception:
Message: Corrupt string
at pdftron.PDF.ElementReader.Next(Native Method)
at pdftron.PDF.ElementReader.next(ElementReader.java:174)

in this part of code:

ElementReader reader = null;
Element = null;
PageIterator itr = null;
Page currentPage = null;
try {
reader = new ElementReader();
for (itr=doc.getPageIterator(); itr.hasNext(); ) {
currentPage = (Page) itr.next();
reader.begin(currentPage);

while((element = reader.next()) != null) { //
an exception occurs during execution of this line for every page of
PDF-document.
// some code . . . . . . .
}

reader.end();
}
} finally {
if ( reader != null ) reader.destroy();
}


A: The most likely problem is that the PDF file is encrypted. In this
case you need to call doc.InitSecurityHandler() after opening a
document (you should probably do this for every document to avoid
potential errors).