我想生成从 Google 应用引擎数据库中检索图像的 pdf。
#Example. This works perfectly fine in the resulting doc
story.append(Image('http://www.python.org/community/logos/python-logo.png'))
#Im omitting the details heres, but photo object is correctly created
photo = ImageReader()
story.append(photo)
#Gives me the error:
#AttributeError: 'ImageReader' object has no attribute 'getKeepWithNext'
#I thought it might had to cast to an Image object, so i tried:
story.append(Image(photo))
#It gives me the error:
#AttributeError: 'ImageReader' object has no attribute 'rfind'
#The error points out to the line where I try to build the doc with the story
doc = SimpleDocTemplate(stream, pagesize=portrait(A4), etc.)
doc.build(story)
我已经看到一些涉及从画布添加图像的解决方案。虽然非常不方便,因为我更愿意向故事添加元素然后创建文档,但我尝试了。它仍然不起作用。
有没有人做到这一点?我的意思是,动态地使用谷歌应用引擎图像、reportlab 和鸭嘴兽。
提前致谢!!!