1 year ago

#329237

test-img

Amisha Saha

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

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?

python

win32com

pdftotext

wps

0 Answers

Your Answer

Accepted video resources