KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I build PDF using ReportLab. My program has a MyDocTemplate(SimpleDocTemplate) class with two methods: beforePage(self) and afterPage(self) which add header and footer (as PNG image) on every page. There is also a MyDocStyle class which describe ParagraphStyle . Main method looks like this: TITLE = Paragraph(Title, MyDocStyle.h1) TO = Paragraph(To, MyDocStyle.h2) FROM = Paragraph(From, MyDocStyle.h2) SUBJECT = Paragraph(Subject, MyDocStyle.h2) LONG_PARAGRAPH = Paragraph(Text, MyDocStyle.h3) ... Elements = [TITLE, TO, FROM, SUBJECT, LONG_PARAGRAPH, ...] doc = MyDocTemplete('output.pdf', pagesize=A4, leftMargin=2*cm, rightMargin=2*cm, topMargin=4*cm, bottomMargin=4*cm) doc.build(Elements) Data comes from CSV files and GUI. From time to time (depends on data length) I receive an error: Flowable <Spacer at 0x2631120 frame=normal>...(1 x 5.66929133858) too large on page 1 in frame 'normal'(469.88976378 x 603.118110236) of template 'First' This exception stop my program. For short Paragraphs I set in MyDocStyle class h2.keepWithNext = 1 however it's not perfect solution. ReportLab split correctly long paragraph if end of paragraph does not "coincide" with end of page (text area). How can I deal with it?
Tags (comma-separated)
Save Edits
Cancel