I am wondering if there is a way in python (tool or function etc.) to convert my pdf file to doc or docx?
I am aware of online converters but I need this in Python code.
Advertisement
Answer
If you have pdf with lot of pages..below code will work:
import PyPDF2 path="C:\ .... " text="" pdf_file = open(path, 'rb') text ="" read_pdf = PyPDF2.PdfFileReader(pdf_file) c = read_pdf.numPages for i in range(c): page = read_pdf.getPage(i) text+=(page.extractText())