Given that you also consider other libraries, I suggest using poppler-util's pdftohtml to convert the pdf to xml:
!apt-get install -y poppler-utils
!pdftohtml -c -hidden -xml document.pdf output.xml
It will output an xml file with the text and top, left, width, and height values for the boxes. It had no issues with the text that pdfminer doesn't recognize.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…