[reportlab-users] Experimenting with new paragraphs, splitting issue
Dinu Gherman
gherman at darwin.in-berlin.de
Wed Nov 28 07:58:59 EST 2007
Hi,
I've experimented quite a bit with several variants of a new really
simple Paragraph class. It mostly works as desired, at least as long
as I used my own faked frames together with the drawOn method. As soon
as I'm using my paragraphs inside a propperly set document template,
I get a strange behaviour when it comes to splitting. It's basically
an issue with creating and returning two pieces of a paragraph.
The RL Userguide contains exactly one paragraph about splitting, some-
thing I take as ironic, since it might also benefit from splitting into
some more. In fact, I have never seen an official example with code
on how to really write one's own wrappable/splittable flowable. So,
I'd be glad to contribute my code if somebody can remove a bit of the
magic behind the scenes.
I attach an archive with the most minimal implementation I could come
up with. The code includes a sample text and is very easy to play with.
I'd be very glad if maybe Robin can have a look.
Regards,
Dinu
PS: This is the debugging output plus traceback I get:
$ python twoCol.py
*** parse Critical and Histori[...]Volume 1 by Macaulay
*** wrap (228.944882, 725.007874)
*** wrap (228.944882, 30.000000) needed
*** parse History, at least in[...]the whole in common.
*** wrap (228.944882, 689.007874)
*** wrap (228.944882, 270.000000) needed
*** parse To make the past pre[...]ct class of writers.
*** wrap (228.944882, 413.007874)
*** wrap (228.944882, 330.000000) needed
*** parse Of the two kinds of [...]ce of a setting sun.
*** wrap (228.944882, 77.007874)
*** wrap (228.944882, 90.000000) needed
*** parse Of the two kinds of [...]ce of a setting sun.
*** split (228.94488188976374, 77.007874015747987)
p1 Of the two kinds of [...], does not enable us
p2 to ascertain with ac[...]ce of a setting sun.
*** parse Of the two kinds of [...], does not enable us
*** wrap (228.944882, 77.007874)
*** wrap (228.944882, 75.000000) needed
*** parse to ascertain with ac[...]ce of a setting sun.
*** split (228.94488188976374, -3.9921259842520129)
p1 to ascertain with ac[...]ulgence of a setting
p2 sun.[...]sun.
Traceback (most recent call last):
File "twoCol.py", line 53, in <module>
main()
File "twoCol.py", line 49, in main
doc.build(story)
File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py",
line 740, in build
self.handle_flowable(flowables)
File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py",
line 663, in handle_flowable
raise LayoutError(ident)
reportlab.platypus.doctemplate.LayoutError: Splitting error(n==2) on page 1 in
<Paragraph at 0x1236378 frame=F1>to ascertain with accuracy the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mini.tgz
Type: application/x-gzip
Size: 9324 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20071128/9f6a2cf9/attachment.bin>
More information about the reportlab-users
mailing list