ReportLab LayoutError: too large on page

我是研究僧i 提交于 2019-12-01 16:37:50
G Gordon Worley III

Found a workaround myself. Based on some code changes made in rst2pdf, I was able to get my code working reliably. The solution, although ugly, is to wrap all my Paragraphs in the section of the code that creates Paragraphs for the student comments inside KeepTogether. For example, I changed one relevant line to:

reportDocContent.append(KeepTogether(Paragraph(commentParagraph, style=commentParagraphStyle)))

and now it works (at least, I haven't been able to break it yet after trying lots of sample data).

yoshi

Looks like this is an old question but I experienced this same error very recently, and came here to find some advices. The fix I made was to make the spacer size a half of the old size. It was previously Spacer(1,0.2*inch) and I changed it to Spacer(1,0.1*inch). Then there are no more such errors.

FYI the error message I got was

  File "/opt/python2.7/lib/python2.7/site-packages/reportlab-2.5-py2.7-linux-x86_64.egg/reportlab/platypus/doctemplate.py", line 1117, in build
    BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
  File "/opt/python2.7/lib/python2.7/site-packages/reportlab-2.5-py2.7-linux-x86_64.egg/reportlab/platypus/doctemplate.py", line 880, in build
    self.handle_flowable(flowables)
  File "/opt/python2.7/lib/python2.7/site-packages/reportlab-2.5-py2.7-linux-x86_64.egg/reportlab/platypus/doctemplate.py", line 793, in handle_flowable
    raise LayoutError(ident)
reportlab.platypus.doctemplate.LayoutError: Flowable <Spacer at 0xf01440 frame=normal>...(1 x 14.4) too large on page 10 in frame 'normal'(439.275590551 x 628.28976378) of template 'Later'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!