At the end there was an error in the code above, the working code is:
public boolean isPDFSearchable(Document m_doc) {
if (m_doc != null) {
int totalPageCount = m_doc.GetPageCount();
for (int pageCount = 0; pageCount <= totalPageCount - 1; pageCount++) {
Page page = m_doc.GetPage(pageCount);
page.ObjsStart();
String text = page.ObjsGetString(0, page.ObjsGetCharCount() - 1);
if (text != null && text.trim().length() > 0) {
return true;
}
}
}
return false;
}
For more info please check
this article.