diff --git a/tests/BaseTestClasses.py b/tests/BaseTestClasses.py index 38f8290..5659f24 100644 --- a/tests/BaseTestClasses.py +++ b/tests/BaseTestClasses.py @@ -367,9 +367,16 @@ def getMetadataField(self, pdf_filename, field_name): return None def getPDFText(self, filename): - text = pdfminer.high_level.extract_text(filename) - text = text.replace("\t", " ") - return text + if os.path.exists(filename): + try: + text = pdfminer.high_level.extract_text(filename) + except pdfminer.pdfparser.PDFSyntaxError: + return None + + text = text.replace("\t", " ") + return text + else: + return None def touch(self, fname): open(fname, 'w').close()