1
import PyPDF4
path = f'C:/Users/Gabriel/Desktop/Curso/Teste/pdfs/teste/ABRAHAO.pdf'

pdf = open(path, 'rb')
reader = PyPDF4.PdfFileReader(pdf, strict=False)
page = reader.getPage(0)
text = page.extractText()
text = text.strip()

reading a pdf file, I tested it with another 295 files and they went smoothly

1 Answers1

1

Add parameter "strict=false".
If this doesn't work then you can try using PyPDF2, tabula or py-pdf-parser.

g.newt
  • 105
  • 3