How to Solve NameError: name 'PDFDocument' is not defined -- pdfminer
Solution: Import the 'PDFDocument' module
To Solve the error, add the following line to the top of your code.
from pdfminer.pdfdocument import PDFDocument
For more information:
Python pdfminer PDFDocument