Join for free and connect with our local tech scene

Stay on top of the latest companies and upcoming events with our weekly newsletter, and be counted among the people building the future of your local tech community.

Louisville, KY /

PDF to text/excel

Avatar_default_60
Thab Shihadah wrote

Hello 

I have this code which will convert PDF into text but I'm trying to compile (build) it as a tool. where I can browse local drive and then select a PDF file then convert it to text  under the same name.

Is that easy to do. 

Thanks,

Thabit 


import PyPDF2

pdfFileObj = open('P://file.pdf', 'rb')

pdfReader = PyPDF2.PdfFileReader(pdfFileObj)

print(pdfReader.numPages)

pageObj = pdfReader.getPage(0)

print(pageObj.extractText())

pdfFileObj.close()