1 year ago

#375915

test-img

khansahab

raise UnrecognizedImageError docx.image.exceptions.UnrecognizedImageError

if pattern.search(para.text):
if para.text.find(str("#i.aadhaarfront_image|height:200|width:200")) > -1:
    para._element.clear_content()
    path = f"media/images/{(self.userdetails).email.split('@')[0]}/{self.adharfront}"
    para.add_run().add_picture(path, width=Inches(6.5), height=Inches(5))

elif para.text.find(str("#i.aadhaarback_image|height:200|width:200")) > -1:
    para._element.clear_content()
    path = f"media/images/{(self.userdetails).email.split('@')[0]}/{self.adharback}"
    para.add_run().add_picture(path, width=Inches(6.5), height=Inches(5))

elif para.text.find(str("#i.pan_image|height:200|width:200")) > -1:
    para._element.clear_content()
    path = f"media/images/{(self.userdetails).email.split('@')[0]}/{self.panimage}"
    para.add_run().add_picture(path, width=Inches(6.5), height=Inches(5))

how to solve this type of error while updating image in documents with help of module DOCX ,in the function add_picture.

raise UnrecognizedImageError docx.image.exceptions.UnrecognizedImageError

python

python-3.x

django

docx

python-docx

0 Answers

Your Answer

Accepted video resources