Check to see if the PDF file allows text extraction.
[read-only property] okToExtractText([out, retval] VARIANT_BOOL *ok)
This function returns false if the PDF file is encrypted and does not allow extraction of text. The owner password can be used to circumvent this: if a valid owner password was supplied to loadFileWithPassword or loadStreamWithPassword, this function will always return true.

If this function returns false, the text extraction functions will not return any text.

If Not pdf.okToExtractText Then ' can't extract text from this document ... End If