Add <pto> tag support to the RML parser

Registered by Borja López Soilán (NeoPolus)

The ReportLab <pto> tag gives the developer a lot of flexibility. It lets you add a trailer on the frame when its contents must be split (i.e.: "please, turn over" or "continues on the next page"), and a header on the next frame ("continued from the previous page"). When used in combination with "<nextFrame/>" it enables the developer to do complex framed page layouts. The RML parser should implement this tag :(

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Example patch adding the required feature:

=== modified file 'bin/report/render/rml2pdf/trml2pdf.py'
--- bin/report/render/rml2pdf/trml2pdf.py 2009-08-27 10:04:54 +0000
+++ bin/report/render/rml2pdf/trml2pdf.py 2009-09-07 16:11:49 +0000
@@ -552,6 +552,29 @@
                 drw.render(self.canv, None)
         return Illustration(node, self.localcontext, self.styles, self)

+
+ def _pto(self, node):
+ sub_story = []
+ pto_header = None
+ pto_trailer = None
+ for node in utils._child_get(node, self):
+ if node.tag == etree.Comment:
+ node.text = ''
+ continue
+ elif node.tag=='pto_header':
+ pto_header = self.render(node)
+ elif node.tag=='pto_trailer':
+ pto_trailer = self.render(node)
+ else:
+ flow = self._flowable(node)
+ if flow:
+ if isinstance(flow,list):
+ sub_story = sub_story + flow
+ else:
+ sub_story.append(flow)
+ return platypus.flowables.PTOContainer(sub_story, trailer=pto_trailer, header=pto_header)
+
+
     def _textual_image(self, node):
         return base64.decodestring(node.text)

@@ -679,6 +702,8 @@
             thickness_hr=node.get('thickness') or 1
             lineCap_hr=node.get('lineCap') or 'round'
             return platypus.flowables.HRFlowable(width=width_hr,color=color.get(color_hr),thickness=float(thickness_hr),lineCap=str(lineCap_hr))
+ elif node.tag=='pto':
+ return self._pto(node)
         else:
             sys.stderr.write('Warning: flowable not yet implemented: %s !\n' % (node.tag,))
             return None

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.