[Django]-Django ReportLab error – 'str' object has no attribute 'getKeepWithNext'

3👍

You are only allowed to add reportlab’s Flowable‘s to the story. If you want to append an image, you have to do it the reportlab way:

change

elements.append('<img src="el45.jpg" height="5">')

to

elements.append(Image('el45.jpg', width=None, height=5))

You have to play with the width and height parameter. Also, you should always multiply the size with the wanted unit, e.g. 5*inch. For further infos, please see chapter 9.3 of the reportlab userguide!

Leave a comment