Hoe kan ik pdf in python lezen?
Ik ken een manier om het naar tekst te converteren, maar ik wil de inhoud rechtstreeks uit pdf lezen.
Kan iemand uitleggen welke module in python het beste is voor pdf-extractie
Antwoord 1, autoriteit 100%
U kunt het PyPDF2-pakket GEBRUIKEN
#install pyDF2
pip install PyPDF2
# importing all the required modules
import PyPDF2
# creating an object
file = open('example.pdf', 'rb')
# creating a pdf reader object
fileReader = PyPDF2.PdfFileReader(file)
# print the number of pages in pdf file
print(fileReader.numPages)
Volg deze documentatie http://pythonhosted.org/PyPDF2/
Antwoord 2, autoriteit 20%
Je kunt de textract-module gebruiken in python
Textract
voor installatie
pip install textract
voor lees pdf
import textract
text = textract.process('path/to/pdf/file', method='pdfminer')
Voor details Textract
Antwoord 3, autoriteit 18%
Probeer PyPDF2.
Er is hier een goede tutorial: https://automatetheboringstuff.com/chapter13/