Convert a pdf (having images) to word file (doc, docx) in python

1.1k views Asked by At

I have a pdf file with multiple images and I want to convert it to an editable word document. I use the WPS application for word editing. I have tried the below code but this opens up the 'supposed converted doc' in pdf format only.

import win32com.client

word = win32com.client.Dispatch("kwps.Application")
word.visible = 1

wordObj = word.Documents.Open("D:/Work/python/report.pdf")
wordObj.SaveAs("D:/Work/python/report.docx", FileFormat=16)

Where am I doing wrong?

0

There are 0 answers