Convert PDF files to Doc in python
I this blog we are going to see how to convert PDF files to Doc in python using a function called pdf2docx.
You can also see how to create URl shortner using python.
Python has a library called pdf2docs. With this library you can convert a pdf file to a word document with just a few lines of code. Using pip, install the library
pip install pdf2docx
We are going to import the Converter class from this module. If the file is in the same directory as your Python script, then you can just provide the name of the file, instead of a link. The
new doc file will be saved in the same directory.
from pdf2docx import Converter
# path to your pdf file
pdf = 'file.pdf'
# Path to where the doc file will be saved
word_file = 'file.docx'
#instantiate converter
cv = Converter(pdf)
cv.convert(word_file)
#close file
cv.close()