From jonas at reportlab.com Mon Feb 2 06:19:32 2009 From: jonas at reportlab.com (jonas wustrack) Date: Mon, 2 Feb 2009 11:19:32 +0000 Subject: [reportlab-users] Release 2.3 approaching... In-Reply-To: <59828.213.10.61.26.1233224979.squirrel@marcans.nl> References: <956003ae0901290106k2c5b55c5v33c6f3fee2c4996d@mail.gmail.com> <59828.213.10.61.26.1233224979.squirrel@marcans.nl> Message-ID: Hi Hans, Sorry for not having replied earlier. We somehow must have missed your initial post. We now checked your patch and it looks fine. It has been applied to the subversion trunk and will be included in the 2.3 release. Thanks, Jonas On Thu, Jan 29, 2009 at 10:29 AM, Hans Brand wrote: > >> We have fixed a lot of broken and obsolete documentation and dealt >> with all the recent patches and bug reports. >> >> > > Hi Andy, > > Recently I mentioned a problem in doctemplate.py > (http://two.pairlist.net/pipermail/reportlab-users/2009-January/007946.html) > and also posted a possible solution. > > I never got any response but the change I suggested in doctemplate.py is > functioning in my system perfectly fine. > > Is it possible for you to include this bugfix in Release 2.3? > > Gr, Hans > > > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Jonas From farid.adigamov at gmail.com Mon Feb 2 14:17:21 2009 From: farid.adigamov at gmail.com (Farid Adigamov) Date: Mon, 2 Feb 2009 22:17:21 +0300 Subject: [reportlab-users] Fitting the area ( table cells for example ) with text Message-ID: <84c131010902021117i2b798ea7hf5a39808bee090ab@mail.gmail.com> Hello! I'm fitting the area ( table cells for example ) with text. How could it be done? Is it possible? For example I have the text: a = "HAVE A NICE DAY" I have to put it to the cell of table, but don't know how long is the string. What steps are possible in this situation? Thanks. Have a nice day ;) -- ,,, ^ .. ^ ,,, -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.barrass at safeonlinebilling.com Mon Feb 2 14:23:11 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Mon, 02 Feb 2009 19:23:11 +0000 Subject: [reportlab-users] Fitting the area ( table cells for example ) with text In-Reply-To: <84c131010902021117i2b798ea7hf5a39808bee090ab@mail.gmail.com> References: <84c131010902021117i2b798ea7hf5a39808bee090ab@mail.gmail.com> Message-ID: <4987481F.7040902@safeonlinebilling.com> Farid Adigamov wrote: > Hello! > I'm fitting the area ( table cells for example ) with text. > How could it be done? Is it possible? > For example I have the text: > > a = "HAVE A NICE DAY" > > I have to put it to the cell of table, but don't know how long is the > string. > What steps are possible in this situation? You could either: [for tables only] not specify the column widths, so the column will expand to the size required to fix the text (which can lead to tables wider than the page) Place the text into a Paragraph() to enable word-wrapping. Wrap the text (or a Paragraph() containing the text) into a KeepInFrame() which can either (by default) shrink or crop it's contents to fit. Hope one of the above helps you out. Paul Barrass. From IStevens at globeandmail.com Mon Feb 2 17:09:06 2009 From: IStevens at globeandmail.com (Stevens, Ian) Date: Mon, 2 Feb 2009 17:09:06 -0500 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB Message-ID: The following patch to pdfimage includes unconverted CMYK images in the PDF to preserve colours. We have clients who pass their PDFs through a preflight tool before sending it to press and want all content to be CMYK. The patch uses PIL's Image.mode to decide whether to convert the image. We've been using this on our production servers since 2.1 without problem. Would it be possible to include this in the upcoming release? Thanks, Ian. --- reportlab-trunk/src/reportlab/pdfgen/pdfimages.py (revision 3413) +++ reportlab-trunk/src/reportlab/pdfgen/pdfimages.py (working copy) @@ -95,17 +95,27 @@ self.source = 'PIL' zlib = import_zlib() if not zlib: return - myimage = image.convert('RGB') + + # Use the colorspace in the image + if image.mode == 'CMYK': + myimage = image + colorspace = 'DeviceCMYK' + else: + myimage = image.convert('RGB') + colorspace = 'RGB' + imgwidth, imgheight = myimage.size # this describes what is in the image itself # *NB* according to the spec you can only use the short form in inline images #imagedata=['BI /Width %d /Height /BitsPerComponent 8 /ColorSpace /%s /Filter [/Filter [ /ASCII85Decode /FlateDecode] ID]' % (imgwidth, imgheight,'RGB')] - imagedata=['BI /W %d /H %d /BPC 8 /CS /RGB /F [/A85 /Fl] ID' % (imgwidth, imgheight)] + imagedata=['BI /W %d /H %d /BPC 8 /CS /%s /F [/A85 /Fl] ID' % (imgwidth, imgheight, colorspace)] #use a flate filter and Ascii Base 85 to compress raw = myimage.tostring() - assert len(raw) == imgwidth*imgheight*3, "Wrong amount of data for image" + + bpp = image.mode == 'CMYK' and 4 or 3 + assert len(raw) == imgwidth*imgheight*bpp, "Wrong amount of data for image" compressed = zlib.compress(raw) #this bit is very fast... encoded = pdfutils._AsciiBase85Encode(compressed) #...sadly this may not be #append in blocks of 60 characters -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Feb 2 17:35:47 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 02 Feb 2009 14:35:47 -0800 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: References: Message-ID: <49877543.60702@probo.com> Stevens, Ian wrote: > The following patch to pdfimage includes unconverted CMYK images in > the PDF to preserve colours. We have clients who pass their PDFs > through a preflight tool before sending it to press and want all > content to be CMYK. The patch uses PIL's Image.mode to decide whether > to convert the image. We've been using this on our production servers > since 2.1 without problem. For what it's worth, this is a VERY useful thing to have. I've been through that same professional preflight process, and you really do get substantially better results if your PDF's JPEGs remain in CMYK. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From robin at reportlab.com Tue Feb 3 05:45:51 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 03 Feb 2009 10:45:51 +0000 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: References: Message-ID: <4988205F.9040907@chamonix.reportlab.co.uk> Stevens, Ian wrote: > The following patch to pdfimage includes unconverted CMYK images in the > PDF to preserve colours. We have clients who pass their PDFs through a > preflight tool before sending it to press and want all content to be > CMYK. The patch uses PIL's Image.mode to decide whether to convert the > image. We've been using this on our production servers since 2.1 without > problem. > > Would it be possible to include this in the upcoming release? > Yes, I see no obvious problem here. I think it's more sensible to move the bpp setting into the first part of the patch though. We should probably think more about greyscale and other common image formats, but not today. As for CMYK in general we have had patches in the past related to CMYK in jpegs. I notice in the code where we load a CMYK image from jpeg that we set a decode array parameter which seems to reverse the sense of the colour values so instead of running 0-1 they run 1-0 instead. Anyone clever here know why we have to do that. I seem to remember when we started doing these patches that the tool (name forgotten) which was creating the CMYK images required this transform (otherwise all the colours were messed up). > Thanks, > Ian. -- Robin Becker From IStevens at globeandmail.com Tue Feb 3 13:16:05 2009 From: IStevens at globeandmail.com (Stevens, Ian) Date: Tue, 3 Feb 2009 13:16:05 -0500 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: <4988205F.9040907@chamonix.reportlab.co.uk> References: <4988205F.9040907@chamonix.reportlab.co.uk> Message-ID: Thanks for including the patch. There's a typo, though: =================================================================== --- src/reportlab/pdfgen/pdfimages.py (revision 3416) +++ src/reportlab/pdfgen/pdfimages.py (working copy) @@ -100,11 +100,11 @@ # Use the colorspace in the image if image.mode == 'CMYK': myimage = image - colorspace = 'DeviceCMYK' + colorSpace = 'DeviceCMYK' bpp = 4 else: myimage = image.convert('RGB') - colorspace = 'RGB' + colorSpace = 'RGB' bpp = 3 imgwidth, imgheight = myimage.size I've noticed the reverse color on JPEG images before but since went with TIFF. I'll see what I can come up with. Ian. > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Robin Becker > Sent: February 3, 2009 5:46 AM > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] Patch for inclusion of CMYK > images as CMYK, not converted to RGB > > Stevens, Ian wrote: > > The following patch to pdfimage includes unconverted CMYK images in > > the PDF to preserve colours. We have clients who pass their PDFs > > through a preflight tool before sending it to press and want all > > content to be CMYK. The patch uses PIL's Image.mode to > decide whether > > to convert the image. We've been using this on our > production servers > > since 2.1 without problem. > > > > Would it be possible to include this in the upcoming release? > > > > Yes, I see no obvious problem here. I think it's more > sensible to move the bpp setting into the first part of the > patch though. > > We should probably think more about greyscale and other > common image formats, but not today. > > As for CMYK in general we have had patches in the past > related to CMYK in jpegs. > I notice in the code where we load a CMYK image from jpeg > that we set a decode array parameter which seems to reverse > the sense of the colour values so instead of running 0-1 they > run 1-0 instead. Anyone clever here know why we have to do > that. I seem to remember when we started doing these patches > that the tool (name > forgotten) which was creating the CMYK images required this > transform (otherwise all the colours were messed up). > > > Thanks, > > Ian. > > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From IStevens at globeandmail.com Tue Feb 3 13:32:19 2009 From: IStevens at globeandmail.com (Stevens, Ian) Date: Tue, 3 Feb 2009 13:32:19 -0500 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: References: <4988205F.9040907@chamonix.reportlab.co.uk> Message-ID: Also, you'll want to remove the first call to image.convert('RGB') on line 98. Ian. > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Stevens, Ian > Sent: February 3, 2009 1:16 PM > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] Patch for inclusion of CMYK > images as CMYK,not converted to RGB > > Thanks for including the patch. There's a typo, though: > > =================================================================== > --- src/reportlab/pdfgen/pdfimages.py (revision 3416) > +++ src/reportlab/pdfgen/pdfimages.py (working copy) > @@ -100,11 +100,11 @@ > # Use the colorspace in the image > if image.mode == 'CMYK': > myimage = image > - colorspace = 'DeviceCMYK' > + colorSpace = 'DeviceCMYK' > bpp = 4 > else: > myimage = image.convert('RGB') > - colorspace = 'RGB' > + colorSpace = 'RGB' > bpp = 3 > imgwidth, imgheight = myimage.size > > I've noticed the reverse color on JPEG images before but > since went with TIFF. I'll see what I can come up with. > > Ian. > > > -----Original Message----- > > From: reportlab-users-bounces at reportlab.com > > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Robin > > Becker > > Sent: February 3, 2009 5:46 AM > > To: Support list for users of Reportlab software > > Subject: Re: [reportlab-users] Patch for inclusion of CMYK > images as > > CMYK, not converted to RGB > > > > Stevens, Ian wrote: > > > The following patch to pdfimage includes unconverted CMYK > images in > > > the PDF to preserve colours. We have clients who pass their PDFs > > > through a preflight tool before sending it to press and want all > > > content to be CMYK. The patch uses PIL's Image.mode to > > decide whether > > > to convert the image. We've been using this on our > > production servers > > > since 2.1 without problem. > > > > > > Would it be possible to include this in the upcoming release? > > > > > > > Yes, I see no obvious problem here. I think it's more > sensible to move > > the bpp setting into the first part of the patch though. > > > > We should probably think more about greyscale and other > common image > > formats, but not today. > > > > As for CMYK in general we have had patches in the past > related to CMYK > > in jpegs. > > I notice in the code where we load a CMYK image from jpeg > that we set > > a decode array parameter which seems to reverse the sense of the > > colour values so instead of running 0-1 they run 1-0 > instead. Anyone > > clever here know why we have to do that. I seem to remember when we > > started doing these patches that the tool (name > > forgotten) which was creating the CMYK images required this > transform > > (otherwise all the colours were messed up). > > > > > Thanks, > > > Ian. > > > > -- > > Robin Becker > > _______________________________________________ > > reportlab-users mailing list > > reportlab-users at reportlab.com > > http://two.pairlist.net/mailman/listinfo/reportlab-users > > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From robin at reportlab.com Tue Feb 3 16:28:49 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 03 Feb 2009 21:28:49 +0000 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: References: <4988205F.9040907@chamonix.reportlab.co.uk> Message-ID: <4988B711.3050103@jessikat.plus.net> Stevens, Ian wrote: > Also, you'll want to remove the first call to image.convert('RGB') on > line 98. > ..... OK redone, can you check when time permits? Also is there an image which we could use to see that stuff is right? Doesn't have to be anything pretty four stripes would be enough. -- Robin Becker From IStevens at globeandmail.com Tue Feb 3 18:07:46 2009 From: IStevens at globeandmail.com (Stevens, Ian) Date: Tue, 3 Feb 2009 18:07:46 -0500 Subject: [reportlab-users] Patch for inclusion of CMYK images as CMYK, not converted to RGB In-Reply-To: <4988B711.3050103@jessikat.plus.net> References: <4988205F.9040907@chamonix.reportlab.co.uk> <4988B711.3050103@jessikat.plus.net> Message-ID: Looks good. I use ImageMagick for most of my images. If you specify a -colorspace CMYK parameter, it will output a CMYK image: > convert logo: -colorspace CMYK logo.jpg > identify -verbose logo.jpg | head -13 Image: logo.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Class: DirectClass Geometry: 641x481+0+0 Type: ColorSeparation Endianess: Undefined Colorspace: CMYK Depth: 8-bit Channel depth: Cyan: 1-bit Magenta: 8-bit Yellow: 8-bit Black: 8-bit Also found this simple image online: http://labs.teppefall.com/cmyk_test2.jpg Sorry, I don't have anything more definitive. Someone else might be able to help out with that. Ian. > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Robin Becker > Sent: February 3, 2009 4:29 PM > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] Patch for inclusion of CMYK > images as CMYK, not converted to RGB > > Stevens, Ian wrote: > > Also, you'll want to remove the first call to > image.convert('RGB') on > > line 98. > > > ..... > OK redone, can you check when time permits? Also is there an > image which we could use to see that stuff is right? Doesn't > have to be anything pretty four stripes would be enough. > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From rvalyi at gmail.com Tue Feb 3 20:41:29 2009 From: rvalyi at gmail.com (=?ISO-8859-1?Q?Rapha=EBl_Valyi?=) Date: Wed, 4 Feb 2009 02:41:29 +0100 Subject: [reportlab-users] patch to make Reportlab work again on Jython In-Reply-To: <956003ae0901300824v39358922p7f93d8452375c893@mail.gmail.com> References: <806313f00901300507o7c427687ic3900621755d79b7@mail.gmail.com> <956003ae0901300816v604f3c79kb7106e9ca21278dd@mail.gmail.com> <956003ae0901300824v39358922p7f93d8452375c893@mail.gmail.com> Message-ID: <806313f00902031741x53693945odf4bdf7644750fe5@mail.gmail.com> Hi Andy and all, yes, Jython knows the '__all__' variable, so may be you can use it for the patch. Also, I didn't try that, but I think my patch could differ less from the original file. Indeed, I wrapped almost every large list instantiation of pdfbase/_fontdata.py in a private method, but I guess that wrapping only a few of them will already make the containing method small enough for the JVM to handle it. Any way, as I said, it's more about applying that dummy patch that has no impact except it's not beautiful (but not so ugly either). Flag it with a big #FIXME remove that when Jython folks fix the issue, and indeed remove the patch in one or two years when Jython doesn't has the issue anymore. As I said, it's not a top priority bug for Jython (hard to fix but rarely occurs). But on the contrary, having softwares like Reportlab or OpenERP running on Jython would also certainly help Sun putting more resources on that, finally helping reportlab too. And to answer your other question, I'm running my test without any accelerator for the moment (happy to know there were one). Having an accelerator is not a top priority for OpenERP on Jython, we should first focus on compatibility, and even if Reportlab is expected to be 100% compatible after my patch is applied, there are a few other issues to port OpenERP on Jython. And since it's still a spare time challenge... Finally, be sure I can run your test suite and provide some feedback (including speed) if Reportlab lets me run it on Jython. I doubt Reportlab will be faster on Jython that soon, but it might be for the end of the year. Bare in mind that JRuby is 2 to 5 times faster than C Ruby (http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=jruby&lang2=ruby more to come...) . JRuby got much more momentum at Sun to go there, plus they had outstanding rock stars like Charles Nutter in their team. Jython got less momentum, but reborn after JRuby proved amazing things could be done on the top of the JVM. After specialists like Charles Nutter or Jim Baker, Jython will go there, probably by the end of the year already, they can reuse a lot what has been done for JRuby too. A 99% 2.5 Python compliant Jython is expected by February. An other thing to consider if you are interested in Jython is Jython multitreading abilities (unlike Python which is sticking to a GIL). For multithreading enable applications, that means more performance and much less memory use (thanks to the shared runtime that can completely compensate the JVM extra memory usage) under huge concurrent loads. Other benefit are portability. If one of you is interested in the OpenERP+reportlab on Jython topic, I started a blog post here: http://rvalyi.blogspot.com/2009/02/openerp-running-on-java-jython-round-1.html Hope to see something done for Jython compatibility. Best regards, Rapha?l Valyi. On Fri, Jan 30, 2009 at 5:24 PM, Andy Robinson wrote: > Rapha?l, does Jython pay attention to '__all__' ? If so, > perhaps we could do something less hacky > and just list the bits we want in an '__all__' variable. > > Sorry but I don't have time to experiment on Jython itself. > > - Andy > From andy at reportlab.com Wed Feb 4 11:59:27 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 4 Feb 2009 16:59:27 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! Message-ID: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> Version 2.3 of the ReportLab library has been released today. New features are listed here: http://www.reportlab.org/whatsnew_2_3.html It's also available on PyPI. Thanks to everyone who contributed patches, bug fixes and other feedback. Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From andy at reportlab.com Wed Feb 4 12:05:24 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 4 Feb 2009 17:05:24 +0000 Subject: [reportlab-users] patch to make Reportlab work again on Jython In-Reply-To: <806313f00902031741x53693945odf4bdf7644750fe5@mail.gmail.com> References: <806313f00901300507o7c427687ic3900621755d79b7@mail.gmail.com> <956003ae0901300816v604f3c79kb7106e9ca21278dd@mail.gmail.com> <956003ae0901300824v39358922p7f93d8452375c893@mail.gmail.com> <806313f00902031741x53693945odf4bdf7644750fe5@mail.gmail.com> Message-ID: <956003ae0902040905j57bc01bbt76291d3dc4dadc6f@mail.gmail.com> 2009/2/4 Rapha?l Valyi : > Hi Andy and all, > > yes, Jython knows the '__all__' variable, so may be you can use it > for the patch. I regret to say we had to leave the 'Jython support' out of today's release; we had a deadline to ship the release, and need a bit longer to study this problem and play with Jython ourselves before we pick a solution. We might even try to update our jar-file deployment from 5 years ago. Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From james.yoo at gmail.com Wed Feb 4 12:51:27 2009 From: james.yoo at gmail.com (James Yoo) Date: Wed, 4 Feb 2009 11:51:27 -0600 Subject: [reportlab-users] small bug in setting tablestyle ??? Message-ID: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> Hello list, disclaimer: I'm new to both python AND reportlab I /think/* I may have found a small bug in the tables.py... I couldn't find any other information relevant to my particular scenario, so I'm inclined to believe that mine is an edge case, and perhaps a bit contrived since the table style documentation seems to assume that one will always be setting a style in a table on a range of cells, or aways referencing the last row or column with -1 Nevertheless, here's the scenario: 1) I am dynamically creating a list of lists to feed to platypus.Table and also conditionally setting table styles on a cell by cell basis... len(data) = 3 len(data[0]) = 2 so, 3 rows, 2 cols. 2) if you happen to be setting style for a single cell in the last column data[0][1] eg: TableStyle.add('FONT', (1,0),(1,0), 'Times-Bold') tables._addCommand does this test to calculate the cell coords for the style: 873 else: 874 (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:] 875 if sc < 0: sc = sc + self._ncols 876 if ec < 0: ec = ec + self._ncols 877 if sr < 0: sr = sr + self._nrows 878 if er < 0: er = er + self._nrows * 879 for i in range(sr, er+1): * *880* * for j in range(sc, ec+1):* 881 _setCellStyle(self._cellStyles, i, j, op, values) you'll get a list index out of range error because of the the range() in line 880 It's simply not checking that your "end column" is actually the index for the last column and NOT -1 Of course, I can work around this in my own code, but it seems like a relatively minor fix to the code above or a minor adjustment to the documentation. - James * maybe it is a feature... -------------- next part -------------- An HTML attachment was scrubbed... URL: From Michael at Hipp.com Wed Feb 4 13:12:02 2009 From: Michael at Hipp.com (Michael Hipp) Date: Wed, 04 Feb 2009 12:12:02 -0600 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> Message-ID: <4989DA72.4020903@Hipp.com> Andy Robinson wrote: > Version 2.3 of the ReportLab library has been released today. New > features are listed here: > > http://www.reportlab.org/whatsnew_2_3.html > > It's also available on PyPI. > > Thanks to everyone who contributed patches, bug fixes and other feedback. Thanks. I don't see anything about full Python 2.6 compatibility. Did it have to be postponed? Thanks, Michael From robin at reportlab.com Wed Feb 4 13:13:38 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 04 Feb 2009 18:13:38 +0000 Subject: [reportlab-users] small bug in setting tablestyle ??? In-Reply-To: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> References: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> Message-ID: <4989DAD2.9050301@chamonix.reportlab.co.uk> James Yoo wrote: > Hello list, > ......... > 2) if you happen to be setting style for a single cell in the last column > data[0][1] > > eg: TableStyle.add('FONT', (1,0),(1,0), 'Times-Bold') > > tables._addCommand does this test to calculate the cell coords for the > style: > > 873 else: > 874 (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:] > 875 if sc < 0: sc = sc + self._ncols > 876 if ec < 0: ec = ec + self._ncols > 877 if sr < 0: sr = sr + self._nrows > 878 if er < 0: er = er + self._nrows > * 879 for i in range(sr, er+1): > * *880* * for j in range(sc, ec+1):* > 881 _setCellStyle(self._cellStyles, i, j, op, > values) > > you'll get a list index out of range error because of the the range() in > line 880 > > It's simply not checking that your "end column" is actually the index for > the last column and NOT -1 > > Of course, I can work around this in my own code, but it seems like a > relatively minor fix to the code above or a minor adjustment to the > documentation. If it's a bug then it's good to know, but here's what happens when I simulate your test scenario by hand. >>> cmd=('FONT', (1,0),(1,0), 'Times-Bold') >>> (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:] >>> for i in range(sr, er+1): ... for j in range(sc, ec+1): ... print i,j ... 0 1 >>> so we ought to be addressing only i=0 and j=1 which we claim is there providing we've added one style for each cell which we attempt to do in the init method where we set cellrows = [] for i in xrange(nrows): cellcols = [] for j in xrange(ncols): cellcols.append(CellStyle(`(i,j)`)) cellrows.append(cellcols) self._cellStyles = cellrows For what it's worth I see your code at line 988 so our versions are out of sync; therefore it might be that something has been fixed. Can you illustrate your cell/style addition with a tiny example? I/we have used essentially this technique before so I believe it ought to work. It is of course easy to break this simplistic scheme by just adding in styles for cells which don't exist. So logically the sr, er, sc & ec values ought to be checked against the actual table dimensions. -- Robin Becker From robin at reportlab.com Wed Feb 4 13:16:14 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 04 Feb 2009 18:16:14 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <4989DA72.4020903@Hipp.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> Message-ID: <4989DB6E.5080009@chamonix.reportlab.co.uk> Michael Hipp wrote: > Andy Robinson wrote: >> Version 2.3 of the ReportLab library has been released today. New >> features are listed here: >> >> http://www.reportlab.org/whatsnew_2_3.html >> >> It's also available on PyPI. >> >> Thanks to everyone who contributed patches, bug fixes and other feedback. > > Thanks. > > I don't see anything about full Python 2.6 compatibility. Did it have to > be postponed? > > Thanks, > Michael ...... We have tried to make it compatible with 2.6. Certainly all the tests run fine and I believe we got rid of some annoying warnings. -- Robin Becker From Michael at Hipp.com Wed Feb 4 13:38:55 2009 From: Michael at Hipp.com (Michael Hipp) Date: Wed, 04 Feb 2009 12:38:55 -0600 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <4989DB6E.5080009@chamonix.reportlab.co.uk> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> <4989DB6E.5080009@chamonix.reportlab.co.uk> Message-ID: <4989E0BF.7090906@Hipp.com> Robin Becker wrote: > Michael Hipp wrote: >> I don't see anything about full Python 2.6 compatibility. Did it have >> to be postponed? > > We have tried to make it compatible with 2.6. Certainly all the tests > run fine and I believe we got rid of some annoying warnings. Great. But I still don't see a binary installer (for 2.6) listed here: http://www.reportlab.org/downloads.html Thanks, Michael From timr at probo.com Wed Feb 4 14:12:19 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 04 Feb 2009 11:12:19 -0800 Subject: [reportlab-users] small bug in setting tablestyle ??? In-Reply-To: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> References: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> Message-ID: <4989E893.1080307@probo.com> James Yoo wrote: > > disclaimer: I'm new to both python AND reportlab > ... > Nevertheless, here's the scenario: > 1) I am dynamically creating a list of lists to feed to platypus.Table > and also conditionally setting table styles on a cell by cell basis... > ... > 2) if you happen to be setting style for a single cell in the last > column data[0][1] > > eg: TableStyle.add('FONT', (1,0),(1,0), 'Times-Bold') > > tables._addCommand does this test to calculate the cell coords for the > style: > > 873 else: > 874 (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:] > 875 if sc < 0: sc = sc + self._ncols > 876 if ec < 0: ec = ec + self._ncols > 877 if sr < 0: sr = sr + self._nrows > 878 if er < 0: er = er + self._nrows > * 879 for i in range(sr, er+1): > * *880* * for j in range(sc, ec+1):* > 881 _setCellStyle(self._cellStyles, i, j, op, > values) > > you'll get a list index out of range error because of the the range() > in line 880 Does it? Remember that a Python range is exclusive of the endpoint. That is, range(0,1) returns one thing: 0. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From james.yoo at gmail.com Wed Feb 4 14:59:30 2009 From: james.yoo at gmail.com (James Yoo) Date: Wed, 4 Feb 2009 13:59:30 -0600 Subject: [reportlab-users] small bug in setting tablestyle ??? In-Reply-To: <4989E893.1080307@probo.com> References: <487323a00902040951q61ad00ayb7f0d377df0ac019@mail.gmail.com> <4989E893.1080307@probo.com> Message-ID: <487323a00902041159h43d5b5bcmb5c5cd2fe53618fa@mail.gmail.com> Robin, Tim, honorable list members.... After I realized the fundamental error I was making in my claim (amature!)... I retraced my steps. Turns out, I was stepping in it, in a big way, and walking all over the carpet to boot.... I had a STATIC var set to a particular TableStyle in my module.... and was using it within my function thinking that I was getting a new copy with each invocation... so I was constantly adding new cellstyles between invocations to the same TableStyle obj... thanks for pointing me out... - "that guy" On Wed, Feb 4, 2009 at 1:12 PM, Tim Roberts wrote: > James Yoo wrote: > > > > disclaimer: I'm new to both python AND reportlab > > ... > > Nevertheless, here's the scenario: > > 1) I am dynamically creating a list of lists to feed to platypus.Table > > and also conditionally setting table styles on a cell by cell basis... > > ... > > 2) if you happen to be setting style for a single cell in the last > > column data[0][1] > > > > eg: TableStyle.add('FONT', (1,0),(1,0), 'Times-Bold') > > > > tables._addCommand does this test to calculate the cell coords for the > > style: > > > > 873 else: > > 874 (op, (sc, sr), (ec, er)), values = cmd[:3] , cmd[3:] > > 875 if sc < 0: sc = sc + self._ncols > > 876 if ec < 0: ec = ec + self._ncols > > 877 if sr < 0: sr = sr + self._nrows > > 878 if er < 0: er = er + self._nrows > > * 879 for i in range(sr, er+1): > > * *880* * for j in range(sc, ec+1):* > > 881 _setCellStyle(self._cellStyles, i, j, op, > > values) > > > > you'll get a list index out of range error because of the the range() > > in line 880 > > Does it? Remember that a Python range is exclusive of the endpoint. > That is, range(0,1) returns one thing: 0. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jconner at EmpireDI.com Wed Feb 4 15:38:41 2009 From: jconner at EmpireDI.com (John Conner) Date: Wed, 04 Feb 2009 13:38:41 -0700 Subject: [reportlab-users] ReportLab 2.3 - still getting errors with 2.6 Message-ID: <4989FCD1.3030306@EmpireDI.com> Hi, Not sure if it is a problem with report lab or maybe python2.6 or maybe freetype. I have been seeing the following error for a while now. Running 'python setup.py tests-preinstall' I get the following: ...................................................................................................................Traceback (most recent call last): File "genreference.py", line 31, in run() File "genreference.py", line 17, in run yaml2pdf.run('reference.yml','reportlab-reference.pdf') File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\tools\docco\yaml2pdf.py", line 54, in run story.append(Paragraph(text, style, bulletText=bulletText)) File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\src\reportlab\platypus\paragraph.py", line 798, in __init__ self._setup(text, style, bulletText, frags, cleanBlockQuotedText) File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\src\reportlab\platypus\paragraph.py", line 816, in _setup % (_parser.errors[0],text[:min(30,len(text))])) ValueError: xml parser error (garbage in start tag) in paragraph beginning 'Very simple and fast XML parse' Failed to import renderPM. F.................................................................. ====================================================================== FAIL: Test if all manuals buildable from source. ---------------------------------------------------------------------- Traceback (most recent call last): File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\tests\test_docs_build.py", line 32, in test0 assert os.path.isfile('reportlab-reference.pdf'), 'genAll.py failed to generate reportlab-reference.pdf!' AssertionError: genAll.py failed to generate reportlab-reference.pdf! ---------------------------------------------------------------------- Ran 182 tests in 71.657s FAILED (failures=1) running 'python setup.py install' gives: ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from 'G:\\downloads\\Python\\ReportLab\\ReportLab_2_3\\ReportLab_2_3\\src\\rl_addons\\rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from 'G:\\downloads\\Python\\ReportLab\\ReportLab_2_3\\ReportLab_2_3\\src\\rl_addons\\renderPM' # installing with win32 freetype 'freetype6.dll' ################################################ running install running build running build_py copying src\reportlab\lib\hyphen.mashed -> build\lib.win32-2.6\reportlab\lib running build_clib building '_renderPM_libart' library error: None Finally running 'python setup.py tests' results in: ...................................................................................................................Traceback (most recent call last): File "genreference.py", line 31, in run() File "genreference.py", line 17, in run yaml2pdf.run('reference.yml','reportlab-reference.pdf') File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\tools\docco\yaml2pdf.py", line 54, in run story.append(Paragraph(text, style, bulletText=bulletText)) File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\src\reportlab\platypus\paragraph.py", line 798, in __init__ self._setup(text, style, bulletText, frags, cleanBlockQuotedText) File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\src\reportlab\platypus\paragraph.py", line 816, in _setup % (_parser.errors[0],text[:min(30,len(text))])) ValueError: xml parser error (garbage in start tag) in paragraph beginning 'Very simple and fast XML parse' Failed to import renderPM. F.................................................................. ====================================================================== FAIL: Test if all manuals buildable from source. ---------------------------------------------------------------------- Traceback (most recent call last): File "G:\downloads\Python\ReportLab\ReportLab_2_3\ReportLab_2_3\tests\test_docs_build.py", line 32, in test0 assert os.path.isfile('reportlab-reference.pdf'), 'genAll.py failed to generate reportlab-reference.pdf!' AssertionError: genAll.py failed to generate reportlab-reference.pdf! ---------------------------------------------------------------------- Ran 182 tests in 72.141s FAILED (failures=1) Any ideas what we've got messed up???? John Conner _____________________ Empire Digital Instruments Colorado Springs, Colorado From andy at reportlab.com Wed Feb 4 15:53:57 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 4 Feb 2009 20:53:57 +0000 Subject: [reportlab-users] ReportLab 2.3 - still getting errors with 2.6 In-Reply-To: <4989FCD1.3030306@EmpireDI.com> References: <4989FCD1.3030306@EmpireDI.com> Message-ID: <956003ae0902041253q88b48f4ye07902a02e9c7f52@mail.gmail.com> 2009/2/4 John Conner : > Hi, > > Not sure if it is a problem with report lab or maybe python2.6 or maybe > freetype. I have been seeing the > following error for a while now. I see you are compiling the C extensions on Windows. Is this because you want to, or because we didn't make clear that Windows packages are available? ;-) It's very likely there is some difference between your compiler setup and ours. We ran tests of the pre-built Windows installers on a bunch of VMs, from Python 2.3 up to Python 2.6, until they all came up clean. Could you try the installer below? http://www.reportlab.org/ftp/reportlab-2.3.win32-py2.6.exe This will install the library and DLLs in site-packages, but none of the docs and tests. That seems to be how the default exe-builder in distutils does things but you could then separately run the test directory you have. Alternatively, just grab the built DLLs from here and put them on your path. The test suite will then hopefully run to completion. http://www.reportlab.org/ftp/win32-dlls/2.6/ Our windows test environments are in the office so we'll investigate further in the (UK) morning.. Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From jconner at EmpireDI.com Wed Feb 4 16:49:38 2009 From: jconner at EmpireDI.com (John Conner) Date: Wed, 04 Feb 2009 14:49:38 -0700 Subject: [reportlab-users] ReportLab 2.3 - still getting errors with 2.6 In-Reply-To: <956003ae0902041253q88b48f4ye07902a02e9c7f52@mail.gmail.com> References: <4989FCD1.3030306@EmpireDI.com> <956003ae0902041253q88b48f4ye07902a02e9c7f52@mail.gmail.com> Message-ID: <498A0D72.7000302@EmpireDI.com> Andy, I figured it was some confusion on my part. I've been away from Python for several years - Mostly doing Fortran. The installer worked fine. Ran the tests and 193 passed with an OK. Next time my buddy is in London (a consultant for some part of what used to be BR) I'll have him by you a pint. Thanks, John Conner _____________________ Empire Digital Instruments Colorado Springs, Colorado Andy Robinson wrote: > 2009/2/4 John Conner : > >> Hi, >> >> Not sure if it is a problem with report lab or maybe python2.6 or maybe >> freetype. I have been seeing the >> following error for a while now. >> > > I see you are compiling the C extensions on Windows. Is this because > you want to, or because we didn't make clear that Windows packages are > available? ;-) It's very likely there is some difference between > your compiler setup and ours. > > We ran tests of the pre-built Windows installers on a bunch of VMs, > from Python 2.3 up to Python 2.6, until they all came up clean. Could > you try the installer below? > > http://www.reportlab.org/ftp/reportlab-2.3.win32-py2.6.exe > > This will install the library and DLLs in site-packages, but none of > the docs and tests. That seems to be how the default exe-builder in > distutils does things but you could then separately run the test > directory you have. > > Alternatively, just grab the built DLLs from here and put them on your > path. The test suite will then hopefully run to completion. > > http://www.reportlab.org/ftp/win32-dlls/2.6/ > > Our windows test environments are in the office so we'll investigate > further in the (UK) morning.. > > > Best Regards, > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamonashroy at gmail.com Thu Feb 5 02:32:24 2009 From: tamonashroy at gmail.com (Tamonash Roy) Date: Thu, 5 Feb 2009 13:02:24 +0530 Subject: [reportlab-users] Problem with transparent png's Message-ID: <2d0a01960902042332j1da0122fw404b97db5c41ea77@mail.gmail.com> Hi ! I've created a pdf document which has a lot of images in it. These images are transparent png images. In my development machine I have windows with python 2.5 and reportlab2.2, whereas in the server it is debian linux, python2.5 and reportlab2.2. The problem is I have a perfect pdf document while I use my development machine, but when the pdf is generated in the server and downloaded, the transparent images have a black background. I got to use these images in the document but dont know how. please help! Sample code used to generate pdf is as follows: f2 = Frame( inch*1.75, inch*7.6, inch*4.75, inch*2.95, leftPadding=0, bottomPadding=0,rightPadding=0, topPadding=2, showBoundary=1) f3 = Frame( inch*1.25, inch*5.75, inch*3.85, inch*1.7, leftPadding=0, bottomPadding=0,rightPadding=0, topPadding=2, showBoundary=1) mainPage = PageTemplate(frames=[f2, f3]) doc = BaseDocTemplate('report_1.pdf', pageTemplates=mainPage, leftMargin=72 ,title=Title, author=Author, showBoundary=0) story = [] story.append(Image("a.png")) story.append(FrameBreak()) story.append(Image("b.png")) doc.build(story) Thanks, Tamonash Roy -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Thu Feb 5 04:20:46 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 5 Feb 2009 09:20:46 +0000 Subject: [reportlab-users] ReportLab 2.3 - still getting errors with 2.6 In-Reply-To: <498A0D72.7000302@EmpireDI.com> References: <4989FCD1.3030306@EmpireDI.com> <956003ae0902041253q88b48f4ye07902a02e9c7f52@mail.gmail.com> <498A0D72.7000302@EmpireDI.com> Message-ID: <956003ae0902050120u7db21bcfufe29a52d4b502d11@mail.gmail.com> 2009/2/4 John Conner : > The installer worked fine. Ran the tests and 193 passed with an OK. Great news! I'll amend the changes page to boast more about Python 2.6 compatibility. - Andy From robin at reportlab.com Thu Feb 5 04:57:15 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 05 Feb 2009 09:57:15 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <4989E0BF.7090906@Hipp.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> <4989DB6E.5080009@chamonix.reportlab.co.uk> <4989E0BF.7090906@Hipp.com> Message-ID: <498AB7FB.5060700@chamonix.reportlab.co.uk> Michael Hipp wrote: > Robin Becker wrote: >> Michael Hipp wrote: >>> I don't see anything about full Python 2.6 compatibility. Did it have >>> to be postponed? >> >> We have tried to make it compatible with 2.6. Certainly all the tests >> run fine and I believe we got rid of some annoying warnings. > > Great. > > But I still don't see a binary installer (for 2.6) listed here: > > http://www.reportlab.org/downloads.html > > Thanks, > Michael ......the exe is there at http://www.reportlab.org/ftp/reportlab-2.3.win32-py2.6.exe just some one decided to use static version number rather than dynamic. I'll fix that page up right away. -- Robin Becker From robin at reportlab.com Thu Feb 5 06:10:21 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 05 Feb 2009 11:10:21 +0000 Subject: [reportlab-users] patch to make Reportlab work again on Jython In-Reply-To: <806313f00901300507o7c427687ic3900621755d79b7@mail.gmail.com> References: <806313f00901300507o7c427687ic3900621755d79b7@mail.gmail.com> Message-ID: <498AC91D.6020407@chamonix.reportlab.co.uk> Rapha?l, we recently introduced some ability for selected people to access and modify at least parts of the reportlab repository. Would it not make sense for us to create a jython branch based on the current reportlab 2.3 and then allow you (and perhaps others) to make patches to that branch? It seems wrong to mess with the base implementation just because the latest jython has some limits. I suppose jython's new model(ie not creating java files) has caused these problems with class size, but I'm sure you'll find other areas where our code needs some tweaks to make it work under jython. Even if you don't want to do the commits yourself it seems to make more sense than doing everything on the trunk. Rapha?l Valyi wrote: > Dear Reportlab developers, ........ > What is your position regarding to this? > -- Robin Becker From rvalyi at gmail.com Thu Feb 5 09:01:47 2009 From: rvalyi at gmail.com (=?ISO-8859-1?Q?Rapha=EBl_Valyi?=) Date: Thu, 5 Feb 2009 15:01:47 +0100 Subject: [reportlab-users] patch to make Reportlab work again on Jython In-Reply-To: <498AC91D.6020407@chamonix.reportlab.co.uk> References: <806313f00901300507o7c427687ic3900621755d79b7@mail.gmail.com> <498AC91D.6020407@chamonix.reportlab.co.uk> Message-ID: <806313f00902050601j1dd7427an24e34477f4c90f4f@mail.gmail.com> Hi Robin, inlined responses, On Thu, Feb 5, 2009 at 12:10 PM, Robin Becker wrote: > Rapha?l, > > we recently introduced some ability for selected people to access and modify > at least parts of the reportlab repository. Would it not make sense for us > to create a jython branch based on the current reportlab 2.3 and then allow > you (and perhaps others) to make patches to that branch? Ok, will do that at least for the current patch I had. > > It seems wrong to mess with the base implementation just because the latest > jython has some limits. I suppose jython's new model(ie not creating java > files) has caused these problems with class size, but I'm sure you'll find > other areas where our code needs some tweaks to make it work under jython. Well may be. I mean if you imagine to release a Jython version at least along with the Python one that would make sense. Moreover, I think you would have to bother propagating your Reportlab improvements on the Jython branch because I unfortunately I'm afraid I'll never assume that. I'm only helping out in my spare time in making the things I believe are right, but you can only expect me to commit that pacth and may be simple others as needs occur. I the mean time if you can't assume to maintain that parallel Jython distro, I think it's just easier to include the minor tweak in the regular distro to make it work. There might be more business around Jython in the near future (depending a lot on what the Sun team can achieve), but currently I'm not sure it will generate enough to sustain large efforts. > Even if you don't want to do the commits yourself it seems to make more > sense than doing everything on the trunk. Well you have my view. On the other way, I can make the commit myself and even see if the tweak could be smaller. In fact I saw that a method was too big and didn't bother trying/guessing what was the minimal change, instead I just wrapped every table/list instantiation here to make it work. May be just one or two wrappings could do the job. Indeed, if that worked before (as you seem to tell), knowing that Jython always had this JVM limitation, I guess this is because that particular file was simply smaller (had no time to confirm though). That would mean that only a few wrapping would make it work. In such a case, may be that tweak would be so minor that it could perfectly be in the regular distro. Meanwhile, if you Reportlab want to bring the Java Reportlab accelerator back to life, I think it definitely makes sense to have a separate branch + distro. Ideally thinks would be modular and clean so that the difference between the two branches would be minimal and auto-magically propagated. In the ideal world that might be much like the JRuby on Rails world. Rails started ignoring JRuby (while Sun started ignoring Rails). Now Sun is fare from ignoring Rails (their Kenai dev platform is just meant to be the regular corporate dev platform while it was a personal proto of some JRuby employee, now Glassfish, the fame J2EE server is just to be developed on... ...Kenai). And now Rails itself started distributing the database JDBC adapter in the regular Rails distro... As I said the same will probably happen with Jython (I see no reason why not), but it might simply take more time. As I said, my own goal is to show the world that a killer ERP (OpenERP) which is using Reportab can be and should be worth running in a Java servlet containter (Modjy). I won't bother making it happen alone in my spare time past this stage. But I'm very much implied professionally with OpenERP integration with increasing demand, so it's just about bridging the gap sooner or later, if that includes giving a hand to reportlab, I would be happy to do my part. Best regards, Rapha?l Valyi. > > > Rapha?l Valyi wrote: >> >> Dear Reportlab developers, > > ........ >> >> What is your position regarding to this? >> > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From Michael at Hipp.com Thu Feb 5 09:22:35 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 05 Feb 2009 08:22:35 -0600 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498AB7FB.5060700@chamonix.reportlab.co.uk> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> <4989DB6E.5080009@chamonix.reportlab.co.uk> <4989E0BF.7090906@Hipp.com> <498AB7FB.5060700@chamonix.reportlab.co.uk> Message-ID: <498AF62B.1060803@Hipp.com> Robin Becker wrote: > Michael Hipp wrote: >> But I still don't see a binary installer (for 2.6) listed here: >> >> http://www.reportlab.org/downloads.html >> > ......the exe is there at > > http://www.reportlab.org/ftp/reportlab-2.3.win32-py2.6.exe > > just some one decided to use static version number rather than dynamic. > I'll fix that page up right away. Thanks! Question: On the download page for Win binaries, do I need to get both the 'Binary Installers' as well as the 'Win32 DLLs and Python Extensions'? Or do I just need one of them? It's not clear to me. http://www.reportlab.org/downloads.html#dlls Thanks, Michael From andy at reportlab.com Thu Feb 5 09:43:37 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 5 Feb 2009 14:43:37 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498AF62B.1060803@Hipp.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> <4989DB6E.5080009@chamonix.reportlab.co.uk> <4989E0BF.7090906@Hipp.com> <498AB7FB.5060700@chamonix.reportlab.co.uk> <498AF62B.1060803@Hipp.com> Message-ID: <956003ae0902050643y4402faa1vde22b468773acf44@mail.gmail.com> 2009/2/5 Michael Hipp : > Question: On the download page for Win binaries, do I need to get both the > 'Binary Installers' as well as the 'Win32 DLLs and Python Extensions'? Or do > I just need one of them? It's not clear to me. Just the binaries. The DLLs are "backup" for people who like to roll their own distributions. We know this page needs a complete rewrite. We're working on it now! - Andy From Michael at Hipp.com Thu Feb 5 11:49:13 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 05 Feb 2009 10:49:13 -0600 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902050643y4402faa1vde22b468773acf44@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <4989DA72.4020903@Hipp.com> <4989DB6E.5080009@chamonix.reportlab.co.uk> <4989E0BF.7090906@Hipp.com> <498AB7FB.5060700@chamonix.reportlab.co.uk> <498AF62B.1060803@Hipp.com> <956003ae0902050643y4402faa1vde22b468773acf44@mail.gmail.com> Message-ID: <498B1889.8010302@Hipp.com> Andy Robinson wrote: > 2009/2/5 Michael Hipp : >> Question: On the download page for Win binaries, do I need to get both the >> 'Binary Installers' as well as the 'Win32 DLLs and Python Extensions'? Or do >> I just need one of them? It's not clear to me. > > Just the binaries. The DLLs are "backup" for people who like to roll > their own distributions. > > We know this page needs a complete rewrite. We're working on it now! Thanks. Some of us simpletons need everything spelled out in baby-talk language :-) Michael From james.yoo at gmail.com Thu Feb 5 17:58:01 2009 From: james.yoo at gmail.com (James Yoo) Date: Thu, 5 Feb 2009 16:58:01 -0600 Subject: [reportlab-users] colwidths question Message-ID: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> Hi... me again.. There is something I am not understanding about colWidths... I'm trying to create a Table with colWidths = (28,10,10,10), those are the widest character lengths of the strings in my columns... I'm obviously not understanding about the units for the column widths because I get a really squished table. Is there an idiom for setting exact widths for columns that I am missing? thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From DJESSUP at usnews.com Thu Feb 5 21:11:36 2009 From: DJESSUP at usnews.com (Jessup, David) Date: Thu, 5 Feb 2009 21:11:36 -0500 Subject: [reportlab-users] colwidths question In-Reply-To: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> Message-ID: <97886A555FD8E14E8F7445D75C11D54DD2E133@EXCHANGE.usn.root.ent> What I tend to do is perform the following import: > from reportlab.lib.units import unit where unit is "inch", "cm", "mm", or "pica". I can then set colWidths = (inch, 2.5 * inch, inch, inch) in units I can measure with a ruler. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of James Yoo Sent: Thursday, February 05, 2009 5:58 PM To: Support list for users of Reportlab software Subject: [reportlab-users] colwidths question Hi... me again.. There is something I am not understanding about colWidths... I'm trying to create a Table with colWidths = (28,10,10,10), those are the widest character lengths of the strings in my columns... I'm obviously not understanding about the units for the column widths because I get a really squished table. Is there an idiom for setting exact widths for columns that I am missing? thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From DJESSUP at usnews.com Thu Feb 5 21:17:36 2009 From: DJESSUP at usnews.com (Jessup, David) Date: Thu, 5 Feb 2009 21:17:36 -0500 Subject: [reportlab-users] colwidths question In-Reply-To: <97886A555FD8E14E8F7445D75C11D54DD2E133@EXCHANGE.usn.root.ent> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> <97886A555FD8E14E8F7445D75C11D54DD2E133@EXCHANGE.usn.root.ent> Message-ID: <97886A555FD8E14E8F7445D75C11D54DD2E134@EXCHANGE.usn.root.ent> One more thing: If I recall correctly, if you don't specify the colWidths, they'll shrink to just fitting the displayed content; you only need to specify the colWidths if your table width would otherwise not fit on a page. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Jessup, David Sent: Thursday, February 05, 2009 9:12 PM To: Support list for users of Reportlab software Subject: Re: [reportlab-users] colwidths question What I tend to do is perform the following import: > from reportlab.lib.units import unit where unit is "inch", "cm", "mm", or "pica". I can then set colWidths = (inch, 2.5 * inch, inch, inch) in units I can measure with a ruler. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of James Yoo Sent: Thursday, February 05, 2009 5:58 PM To: Support list for users of Reportlab software Subject: [reportlab-users] colwidths question Hi... me again.. There is something I am not understanding about colWidths... I'm trying to create a Table with colWidths = (28,10,10,10), those are the widest character lengths of the strings in my columns... I'm obviously not understanding about the units for the column widths because I get a really squished table. Is there an idiom for setting exact widths for columns that I am missing? thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From aklaver at comcast.net Thu Feb 5 21:24:14 2009 From: aklaver at comcast.net (Adrian Klaver) Date: Thu, 5 Feb 2009 18:24:14 -0800 Subject: [reportlab-users] colwidths question In-Reply-To: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> Message-ID: <200902051824.14795.aklaver@comcast.net> On Thursday 05 February 2009 2:58:01 pm James Yoo wrote: > Hi... me again.. > > There is something I am not understanding about colWidths... > I'm trying to create a Table with colWidths = (28,10,10,10), those are the > widest character lengths of the strings in my columns... > > I'm obviously not understanding about the units for the column widths > because I get a really squished table. > > Is there an idiom for setting exact widths for columns that I am missing? > > thanks, > James If I remember correctly the units are in picas(1/72 inch). -- Adrian Klaver aklaver at comcast.net From dave at bcs.co.nz Thu Feb 5 22:54:12 2009 From: dave at bcs.co.nz (David Brooks) Date: Fri, 06 Feb 2009 16:54:12 +1300 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> Message-ID: <498BB464.60803@bcs.co.nz> I've just tried an "easy_install" on a Centos box which has Python 2.5 and got: # easy_install reportlab Searching for reportlab Reading http://pypi.python.org/simple/reportlab/ Reading http://www.reportlab.com/ Reading http://www.reportlab.org/downloads.html Best match: reportlab daily-win32 Downloading http://www.reportlab.org/ftp/reportlab-daily-win32.zip Where did "reportlab-daily-win32.zip" come from...?? Thanks, Dave On 5/2/09 5:59 AM, Andy Robinson wrote: > Version 2.3 of the ReportLab library has been released today. New > features are listed here: > > http://www.reportlab.org/whatsnew_2_3.html > > It's also available on PyPI. > > Thanks to everyone who contributed patches, bug fixes and other feedback. > > Best Regards, > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Fri Feb 6 04:09:36 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 09:09:36 +0000 Subject: [reportlab-users] colwidths question In-Reply-To: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> Message-ID: <956003ae0902060109p4033dfes753b94e848914db3@mail.gmail.com> 2009/2/5 James Yoo : > Hi... me again.. > > There is something I am not understanding about colWidths... > I'm trying to create a Table with colWidths = (28,10,10,10), those are the > widest character lengths of the strings in my columns... All units are in points (1/72 of an inch). The table class will auto-size for you if you omit the colWidths. - Andy From andy at reportlab.com Fri Feb 6 04:14:39 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 09:14:39 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498BB464.60803@bcs.co.nz> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> Message-ID: <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> 2009/2/6 David Brooks : > I've just tried an "easy_install" on a Centos box which has Python 2.5 and > got: I haven't a clue. There is no reference to this file in the information we loaded onto PyPI, and we offer a classic distutils-style setup script which works as far as we can tell. To be clear, we do not support easy_install. Clearly, it has decided to (half-) support us in some kind of devious and broken manner, by telling the world to fetch a random package from our web site. Maybe someone who understands pypi can tell us what's wrong with the following, and how easy_install manages to get from what we shipped to the unrelated file you mentioned... http://pypi.python.org/pypi/reportlab/2.3 The files are available there and on our own web site. - Andy From cito at online.de Fri Feb 6 05:37:13 2009 From: cito at online.de (Christoph Zwerschke) Date: Fri, 06 Feb 2009 11:37:13 +0100 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> Message-ID: <498C12D9.7010903@online.de> Andy Robinson schrieb: > Maybe someone who understands pypi can tell us what's wrong with the > following, and how easy_install manages to get from what we shipped to > the unrelated file you mentioned... > > http://pypi.python.org/pypi/reportlab/2.3 > > The files are available there and on our own web site. http://pypi.python.org/pypi/reportlab/2.0 is still active which has http://www.reportlab.org/downloads.html as download page and the daily snapshot is obviously the latest version it can find there. -- Christoph From robin at reportlab.com Fri Feb 6 05:55:05 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 06 Feb 2009 10:55:05 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498C12D9.7010903@online.de> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> <498C12D9.7010903@online.de> Message-ID: <498C1709.3030604@chamonix.reportlab.co.uk> Christoph Zwerschke wrote: > Andy Robinson schrieb: >> Maybe someone who understands pypi can tell us what's wrong with the >> following, and how easy_install manages to get from what we shipped to >> the unrelated file you mentioned... >> >> http://pypi.python.org/pypi/reportlab/2.3 >> >> The files are available there and on our own web site. > > http://pypi.python.org/pypi/reportlab/2.0 is still active which has > http://www.reportlab.org/downloads.html as download page and the daily > snapshot is obviously the latest version it can find there. > > -- Christoph ........ I'm not sure what it means to find a version. Does easy_install attempt to guess what files to download from a web page that is intended to be read by humans? If so, easy_install must be an advanced program indeed. -- Robin Becker From andy at reportlab.com Fri Feb 6 05:56:00 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 10:56:00 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498C12D9.7010903@online.de> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> <498C12D9.7010903@online.de> Message-ID: <956003ae0902060256j425203d9x29ba611383a39411@mail.gmail.com> 2009/2/6 Christoph Zwerschke : > http://pypi.python.org/pypi/reportlab/2.0 is still active which has > http://www.reportlab.org/downloads.html as download page and the daily > snapshot is obviously the latest version it can find there. So easy_install parses our HTML and finds the most recent timestamped file on it? How utterly fragile and moronic. Their documentation is no use on this, except to suggest that I can use --allow-hosts=None to stop the world from using easy_install (arguably a good solution). I guess I have to read the setuptools code in order to 'not support it' better - Andy From cito at online.de Fri Feb 6 06:30:26 2009 From: cito at online.de (Christoph Zwerschke) Date: Fri, 06 Feb 2009 12:30:26 +0100 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902060256j425203d9x29ba611383a39411@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> <498C12D9.7010903@online.de> <956003ae0902060256j425203d9x29ba611383a39411@mail.gmail.com> Message-ID: <498C1F52.4000209@online.de> Andy Robinson schrieb: > 2009/2/6 Christoph Zwerschke : >> http://pypi.python.org/pypi/reportlab/2.0 is still active which has >> http://www.reportlab.org/downloads.html as download page and the daily >> snapshot is obviously the latest version it can find there. > > So easy_install parses our HTML and finds the most recent timestamped > file on it? How utterly fragile and moronic. Yes, it scans the links in the HTML code. But the selection is done by interpretation of the name of the URLs (which can contain version, checksum etc.) and introspection of the packages, not by timestamp. There is some documentation here: http://peak.telecommunity.com/DevCenter/setuptools#making-your-package-available-for-easyinstall http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api Daily snapshots should be built like this: http://peak.telecommunity.com/DevCenter/setuptools#egg-info-examples -- Christoph From andy at reportlab.com Fri Feb 6 06:59:59 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 11:59:59 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <498C1F52.4000209@online.de> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> <498C12D9.7010903@online.de> <956003ae0902060256j425203d9x29ba611383a39411@mail.gmail.com> <498C1F52.4000209@online.de> Message-ID: <956003ae0902060359w47d2e4aaxc7829d524c8c254d@mail.gmail.com> 2009/2/6 Christoph Zwerschke : > Yes, it scans the links in the HTML code. But the selection is done by > interpretation of the name of the URLs (which can contain version, checksum > etc.) and introspection of the packages, not by timestamp. Thanks for the links, but we already studied those and they don't help. Everything on PyPI looks correctly configured; 2.0 is marked as 'hidden' but I see no reason why we should take it down. I had to trace through the setuptools code as it runs to find the problem. It parses a simple listing file on python.org with the distros we uploade (which seems reasonable), and also spiders our whole damned site, looking for files ending in .tar.gz, .tgz, .zip, .egg etc. But it makes assumptions about the way packages are named, and the fact that we used "ReportLab_2_3.tgz" instead of "reportlab-2.3.tgz" causes it to skip past and say "unknown version" on almost all of them. I went for a quick workaround and removed the download URLs from PyPI, so easy_install at least gives up now rather than getting the wrong package. I'll try a few more experiments and update people later. Changing the package names we used for 7 years is frankly a major pain in the arse, but maybe we can rename the output packages uploaded to PyPI - Andy From andy at reportlab.com Fri Feb 6 07:38:59 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 12:38:59 +0000 Subject: [reportlab-users] ReportLab 2.3 is out! In-Reply-To: <956003ae0902060359w47d2e4aaxc7829d524c8c254d@mail.gmail.com> References: <956003ae0902040859r70828034rc8118150f737cdaa@mail.gmail.com> <498BB464.60803@bcs.co.nz> <956003ae0902060114y459eaa81s41ba03fad517f80f@mail.gmail.com> <498C12D9.7010903@online.de> <956003ae0902060256j425203d9x29ba611383a39411@mail.gmail.com> <498C1F52.4000209@online.de> <956003ae0902060359w47d2e4aaxc7829d524c8c254d@mail.gmail.com> Message-ID: <956003ae0902060438h5d9fe286t6083c50339c2afe8@mail.gmail.com> 2009/2/6 Andy Robinson : > I'll try a few more experiments and update people later. Changing the > package names we used for 7 years is frankly a major pain in the arse, > but maybe we can rename the output packages uploaded to PyPI OK, I renamed the packages on PyPI, and it finds them. We'll probably change our naming conventions; what he expects seems reasonable and common... http://peak.telecommunity.com/DevCenter/setuptools#specifying-your-project-s-version easy_install now finds the latest package fast, but fails for less trivial reasons (compiler errors with libart). However, when I unpack and run "python setup.py install", it works perfectly. I suspect the problem is that our source distro is made with 'svn export' and 'tar', and lacks some magic stuff 'sdist' does. This is as far as we can take it today. If anyone has time to look at why easy_install can't handle our working (classic) setup script, I'd be interested, but I have to work on other stuff. However, we are not going to switch to a setuptools-based setup script at this time. - Andy From timr at probo.com Fri Feb 6 12:38:43 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 06 Feb 2009 09:38:43 -0800 Subject: [reportlab-users] colwidths question In-Reply-To: <200902051824.14795.aklaver@comcast.net> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> <200902051824.14795.aklaver@comcast.net> Message-ID: <498C75A3.7060606@probo.com> Adrian Klaver wrote: > If I remember correctly the units are in picas(1/72 inch). > Just for completeness, Postscript's native units (which is what a PDF is) are 1/72 inch, but those are points. A pica is 12 points, or 1/6 inch. There are other weird units you sometimes encounter. A traditional printer's point is actually just over 1/72.27 inch. A "Didot point", used in some European typesetting, is about 1/67.55 inch. It was defined as 1/72 of the "French royal inch", which was slightly longer than the English inch. A cicero is 12 Didot points. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From james.yoo at gmail.com Fri Feb 6 13:07:22 2009 From: james.yoo at gmail.com (James Yoo) Date: Fri, 6 Feb 2009 12:07:22 -0600 Subject: [reportlab-users] colwidths question In-Reply-To: <498C75A3.7060606@probo.com> References: <487323a00902051458v1e42669cv51c1fe5e8735915f@mail.gmail.com> <200902051824.14795.aklaver@comcast.net> <498C75A3.7060606@probo.com> Message-ID: <487323a00902061007o139382e0o14e708694671c226@mail.gmail.com> thanks everyone... I found a stringWidths function inside pdfmetrics module and am using that with good results. On Fri, Feb 6, 2009 at 11:38 AM, Tim Roberts wrote: > Adrian Klaver wrote: > > If I remember correctly the units are in picas(1/72 inch). > > > > Just for completeness, Postscript's native units (which is what a PDF > is) are 1/72 inch, but those are points. A pica is 12 points, or 1/6 inch. > > There are other weird units you sometimes encounter. A traditional > printer's point is actually just over 1/72.27 inch. A "Didot point", > used in some European typesetting, is about 1/67.55 inch. It was > defined as 1/72 of the "French royal inch", which was slightly longer > than the English inch. A cicero is 12 Didot points. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Fri Feb 6 14:48:50 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 6 Feb 2009 19:48:50 +0000 Subject: [reportlab-users] Download page tidied up a little Message-ID: <956003ae0902061148ua37bd5t2ec0d275f183fad3@mail.gmail.com> This page hopefully makes a lot more sense now... http://www.reportlab.org/downloads.html We plan to redo the site completely this quarter, but hopefully this will help in the meantime. Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. From Michael at Hipp.com Fri Feb 6 16:26:20 2009 From: Michael at Hipp.com (Michael Hipp) Date: Fri, 06 Feb 2009 15:26:20 -0600 Subject: [reportlab-users] Download page tidied up a little In-Reply-To: <956003ae0902061148ua37bd5t2ec0d275f183fad3@mail.gmail.com> References: <956003ae0902061148ua37bd5t2ec0d275f183fad3@mail.gmail.com> Message-ID: <498CAAFC.8040602@Hipp.com> Andy Robinson wrote: > This page hopefully makes a lot more sense now... > > http://www.reportlab.org/downloads.html > > We plan to redo the site completely this quarter, but hopefully this > will help in the meantime. Looks good; much clearer. Thanks. Michael From cfoster at oda.state.or.us Mon Feb 9 18:52:48 2009 From: cfoster at oda.state.or.us (Chris Foster) Date: Mon, 9 Feb 2009 15:52:48 -0800 Subject: [reportlab-users] Saving annotations with Platypus Message-ID: I'm passing a "subject" to a DocTemplate, but it doesn't seem to stick. Is there something I need to do to explicitly save it to the canvas? From david at davidheath.org Tue Feb 10 03:30:43 2009 From: david at davidheath.org (David Heath) Date: Tue, 10 Feb 2009 08:30:43 +0000 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> Message-ID: <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> Hi, I've been using Reportlab for a little while for generating PDFs for a web application I'm working on. The library is excellent - very well thought through and documented .. thanks! I now have a need to allow a graphic designer to independently create and amend visual designs for the generated PDFs, and have designated areas of the design filled with dynamic content. Do you have any suggestions about how to do this? Is there a way, for example to import a base 'layer' from a PDF file, and then add additional elements programmatically? Or is there some other vector format (XML:FO, PS or EPS?) which could be imported and added to using reportlab. I'm not very familiar with the export capabilities of current editing programs such as illustrator (I'm a linux-based programmer :-)), so I'm open minded about possible solutions. Looking forward to hearing any thoughts or suggestions you can offer. Best wishes David Heath -- http://davidheath.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Tue Feb 10 03:47:48 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 10 Feb 2009 09:47:48 +0100 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> Message-ID: <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> David Heath: > Looking forward to hearing any thoughts or suggestions you can offer. There are many responses to this in the archive of this mailing list. Regards, Dinu From cito at online.de Tue Feb 10 04:58:54 2009 From: cito at online.de (Christoph Zwerschke) Date: Tue, 10 Feb 2009 10:58:54 +0100 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> Message-ID: <49914FDE.2040702@online.de> Dinu Gherman schrieb: >> Looking forward to hearing any thoughts or suggestions you can offer. > > There are many responses to this in the archive of this mailing list. Which indicates that it should be added to the FAQ (e.g. as 2.1.6). -- Christoph From wthie at thiengineering.ch Tue Feb 10 05:11:39 2009 From: wthie at thiengineering.ch (Werner Thie) Date: Tue, 10 Feb 2009 11:11:39 +0100 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <49914FDE.2040702@online.de> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> <49914FDE.2040702@online.de> Message-ID: <499152DB.1010103@thiengineering.ch> I personally use the z3c.rml implementation and are quite happy with it. You get a FOSS reimplementation of RML which does PDF as a template thing and a lot more. HTH, Werner Christoph Zwerschke wrote: > Dinu Gherman schrieb: >>> Looking forward to hearing any thoughts or suggestions you can offer. >> There are many responses to this in the archive of this mailing list. > > Which indicates that it should be added to the FAQ (e.g. as 2.1.6). > > -- Christoph > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From robin at reportlab.com Tue Feb 10 05:32:06 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 10 Feb 2009 10:32:06 +0000 Subject: [reportlab-users] Saving annotations with Platypus In-Reply-To: References: Message-ID: <499157A6.8050304@chamonix.reportlab.co.uk> Chris Foster wrote: > I'm passing a "subject" to a DocTemplate, but it doesn't seem to stick. > Is there something I need to do to explicitly save it to the canvas? > _______________________________________________ ...... well I've just tried this in test_platypus_general.py. I added subject='test0' so that line 555 in func run lookes like doc = AndyTemplate(outputfile('test_platypus_general.pdf'),subject='test0') when I run the test the document test_platypus_general.pdf does have a subject of test0 (as viewed in the document properties). However, this is not a standard annotation, but a PDFInfo object which is a special dictionary that's part of the PDF trailer. -- Robin Becker From david at davidheath.org Tue Feb 10 05:33:14 2009 From: david at davidheath.org (David Heath) Date: Tue, 10 Feb 2009 10:33:14 +0000 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <499152DB.1010103@thiengineering.ch> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> <49914FDE.2040702@online.de> <499152DB.1010103@thiengineering.ch> Message-ID: <345b57c50902100233q6761b5e5ga29dc983bd46acfc@mail.gmail.com> On 2/10/09, Werner Thie wrote: > I personally use the z3c.rml implementation and are quite happy with it. > You get a FOSS reimplementation of RML which does PDF as a template > thing and a lot more. Hi Werner, thanks that sounds very useful and interesting, I hadn't heard of the z3c.rml implementation. I had a look at the documentation, but I couldn't see any obvious way to use a PDF file as a template. Would you be able to give me a simple example, or point me in the right direction? thanks David From andy at reportlab.com Tue Feb 10 06:09:43 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 10 Feb 2009 11:09:43 +0000 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <49914FDE.2040702@online.de> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> <49914FDE.2040702@online.de> Message-ID: <956003ae0902100309y3db8a0d1oe259489c5f0cd758@mail.gmail.com> 2009/2/10 Christoph Zwerschke : > Dinu Gherman schrieb: >>> Looking forward to hearing any thoughts or suggestions you can offer. >> >> There are many responses to this in the archive of this mailing list. > > Which indicates that it should be added to the FAQ (e.g. as 2.1.6). > Done. - Andy From david at davidheath.org Tue Feb 10 08:01:38 2009 From: david at davidheath.org (David Heath) Date: Tue, 10 Feb 2009 13:01:38 +0000 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <4991702B.6010907@thiengineering.ch> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> <49914FDE.2040702@online.de> <499152DB.1010103@thiengineering.ch> <345b57c50902100233q6761b5e5ga29dc983bd46acfc@mail.gmail.com> <4991702B.6010907@thiengineering.ch> Message-ID: <345b57c50902100501t5afdf7c7jef02f6b1363527c6@mail.gmail.com> > some .pdf file called fw2.pdf is merged into the current document and > then gets something drawn on top. I doubt that there is an out of the > box solution which pulls up .pdf back to the same level as RML and let > you change it, but for me the mergePage solved all my templating > business, as far as graphics or or letterhead or other prefabbed pdf > stuff goes. Great, that sounds like it would do the job. I just need a 'decorative background' above which I'll add additional content. Thanks for your help. David From cito at online.de Tue Feb 10 09:03:35 2009 From: cito at online.de (Christoph Zwerschke) Date: Tue, 10 Feb 2009 15:03:35 +0100 Subject: [reportlab-users] Can I build a PDF from a template? In-Reply-To: <956003ae0902100309y3db8a0d1oe259489c5f0cd758@mail.gmail.com> References: <345b57c50902090423n5793058bn38016ea7d5f6ccd5@mail.gmail.com> <345b57c50902100030h683e26cfo6a485f4e2e308f53@mail.gmail.com> <385F600C-4186-47C4-8B5D-1E599E7827B7@darwin.in-berlin.de> <49914FDE.2040702@online.de> <956003ae0902100309y3db8a0d1oe259489c5f0cd758@mail.gmail.com> Message-ID: <49918937.7090901@online.de> Andy Robinson schrieb: > 2009/2/10 Christoph Zwerschke : >> Dinu Gherman schrieb: >>> There are many responses to this in the archive of this mailing list. >> Which indicates that it should be added to the FAQ (e.g. as 2.1.6). > > Done. Thanks, though I think you answered a different question than the one of the op ;-) -- Christoph From cfoster at oda.state.or.us Tue Feb 10 18:58:15 2009 From: cfoster at oda.state.or.us (Chris Foster) Date: Tue, 10 Feb 2009 15:58:15 -0800 Subject: [reportlab-users] Saving annotations with Platypus In-Reply-To: <499157A6.8050304@chamonix.reportlab.co.uk> References: <499157A6.8050304@chamonix.reportlab.co.uk> Message-ID: <2F658387-82B7-4FAF-B29D-6E398ED566C1@oda.state.or.us> Thank you. Your test code works fine and I re-implemented my DocTemplate subclass to closely match the test code and it is now working. I can see the results with the Mac Preview application BTW. However, I'm still missing something subtle. I had to explicitly save the canvas. It looks like this should have happened by default in _endBuild()? On Feb 10, 2009, at 2:32 AM, Robin Becker wrote: > Chris Foster wrote: >> I'm passing a "subject" to a DocTemplate, but it doesn't seem to >> stick. Is there something I need to do to explicitly save it to >> the canvas? >> _______________________________________________ > ...... > well I've just tried this in test_platypus_general.py. I added > subject='test0' so that line 555 in func run lookes like > > doc = > AndyTemplate(outputfile('test_platypus_general.pdf'),subject='test0') > > when I run the test the document test_platypus_general.pdf does > have a subject of test0 (as viewed in the document properties). > However, this is not a standard annotation, but a PDFInfo object > which is a special dictionary that's part of the PDF trailer. > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From gogtesuyash at gmail.com Wed Feb 11 05:50:16 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Wed, 11 Feb 2009 16:20:16 +0530 Subject: [reportlab-users] How to add two flowables horizontally Message-ID: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> hi frndz... i m adding one table of say 8 rows n piechart....but i want to add them on my Doc horizontally ...means want to add them side by side or on same line... How can i do this...i m using Story object which has append method which appends vertically....means Plz do reply...Its urgent thnks -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Feb 11 05:54:27 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 11 Feb 2009 10:54:27 +0000 Subject: [reportlab-users] Saving annotations with Platypus In-Reply-To: <2F658387-82B7-4FAF-B29D-6E398ED566C1@oda.state.or.us> References: <499157A6.8050304@chamonix.reportlab.co.uk> <2F658387-82B7-4FAF-B29D-6E398ED566C1@oda.state.or.us> Message-ID: <4992AE63.10403@chamonix.reportlab.co.uk> Chris Foster wrote: > Thank you. > > Your test code works fine and I re-implemented my DocTemplate subclass > to closely match the test code and it is now working. I can see the > results with the Mac Preview application BTW. However, I'm still > missing something subtle. I had to explicitly save the canvas. It > looks like this should have happened by default in _endBuild()? > ........ Certainly if you are calling all the standard methods eg build/multiBuild then _endBuild gets called and providing you don't mess with _doSave the canvas gets saved. Since you've got your own class perhaps you've missed out a call to something. Without seeing your class it's pretty hard to figure out what's going wrong. -- Robin Becker From wietse.j at gmail.com Wed Feb 11 06:33:21 2009 From: wietse.j at gmail.com (Wietse Jacobs) Date: Wed, 11 Feb 2009 12:33:21 +0100 Subject: [reportlab-users] How to add two flowables horizontally In-Reply-To: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> References: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> Message-ID: <7d9c65800902110333v2d63d289o19070e5b86f03d35@mail.gmail.com> 2009/2/11 Suyash Gogte : > i m adding one table of say 8 rows n piechart....but i want to add them on > my Doc horizontally ...means want to add them side by side or on same > line... > How can i do this...i m using Story object which has append method which > appends vertically....means You can put them both in a table with 1 row: story.append(Table([[chart_obj, table_obj]]), style=appropriate_style) -- --Wietse From gogtesuyash at gmail.com Wed Feb 11 07:20:22 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Wed, 11 Feb 2009 17:50:22 +0530 Subject: [reportlab-users] How to align object Message-ID: <5797af200902110420n45f4d129i858d6b9f75b2adf4@mail.gmail.com> hi frnds can anyone tell me how to align boject that is passsed to Story object e.g Story.append(table Instance) i want to align this table instance how to do that thnks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: From meyer at mesw.de Wed Feb 11 07:23:19 2009 From: meyer at mesw.de (Markus Meyer) Date: Wed, 11 Feb 2009 13:23:19 +0100 Subject: [reportlab-users] EAN-5 barcodes? Message-ID: <4992C337.8050602@mesw.de> Hi everyone, who is responsible for maintaining the barcode functionality in ReportLab? I see that ReportLab has support for creating EAN-8 and EAN-13 barcodes, but I would like to create an EAN-5 barcode, which is often used next to a ISBN barcode to designate the book price. I would even be willing to pay someone for adding this functionality if it is not trivial. Regards, Markus From gogtesuyash at gmail.com Wed Feb 11 07:34:46 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Wed, 11 Feb 2009 18:04:46 +0530 Subject: [reportlab-users] How to add two flowables horizontally In-Reply-To: <7d9c65800902110333v2d63d289o19070e5b86f03d35@mail.gmail.com> References: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> <7d9c65800902110333v2d63d289o19070e5b86f03d35@mail.gmail.com> Message-ID: <5797af200902110434k4b1f0f84k42e7135f25bae109@mail.gmail.com> thnks its working but can u plz tell me......how to align it means for e.g Global Data : On Wed, Feb 11, 2009 at 5:03 PM, Wietse Jacobs wrote: > 2009/2/11 Suyash Gogte : > > i m adding one table of say 8 rows n piechart....but i want to add them > on > > my Doc horizontally ...means want to add them side by side or on same > > line... > > How can i do this...i m using Story object which has append method which > > appends vertically....means > > You can put them both in a table with 1 row: > story.append(Table([[chart_obj, table_obj]]), style=appropriate_style) > > -- > --Wietse > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wietse.j at gmail.com Wed Feb 11 08:30:20 2009 From: wietse.j at gmail.com (Wietse Jacobs) Date: Wed, 11 Feb 2009 14:30:20 +0100 Subject: [reportlab-users] How to add two flowables horizontally In-Reply-To: <5797af200902110434k4b1f0f84k42e7135f25bae109@mail.gmail.com> References: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> <7d9c65800902110333v2d63d289o19070e5b86f03d35@mail.gmail.com> <5797af200902110434k4b1f0f84k42e7135f25bae109@mail.gmail.com> Message-ID: <7d9c65800902110530q5a3ecb9ex8684e4c1b5cb2570@mail.gmail.com> 2009/2/11 Suyash Gogte : > thnks its working but can u plz tell me......how to align it means > for e.g > > Global Data : That's chapter 7 of the User Guide: "Tables and TableStyles". story.append(Table([[chart_obj, table_obj]], style=appropriate_style)) with an appropriate appropriate_style, e.g.: appropriate_style = [ ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), ('ALIGN', (0,0), (0,-1), 'RIGHT'), ('ALIGN', (1,0), (1,-1), 'LEFT'), ('GRID', (0,0), (-1,-1), 1, colors.pink), ] -- --Wietse From robin at reportlab.com Wed Feb 11 08:57:24 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 11 Feb 2009 13:57:24 +0000 Subject: [reportlab-users] EAN-5 barcodes? In-Reply-To: <4992C337.8050602@mesw.de> References: <4992C337.8050602@mesw.de> Message-ID: <4992D944.5040108@chamonix.reportlab.co.uk> Markus Meyer wrote: > Hi everyone, > > who is responsible for maintaining the barcode functionality in > ReportLab? I see that ReportLab has support for creating EAN-8 and > EAN-13 barcodes, but I would like to create an EAN-5 barcode, which is > often used next to a ISBN barcode to designate the book price. > > I would even be willing to pay someone for adding this functionality if > it is not trivial. > > Regards, > Markus ...... the original barcode coding was contributed by Ty Sarna, but I have been maintaining and improving it for a while now. As I understand it ean-5 is an extension to ean-13 (as is ean-8), but its structure differs somewhat. I don't think this would take too long, but we're flat out at present. -- Robin Becker From meyer at mesw.de Wed Feb 11 09:43:25 2009 From: meyer at mesw.de (Markus Meyer) Date: Wed, 11 Feb 2009 15:43:25 +0100 Subject: [reportlab-users] EAN-5 barcodes? In-Reply-To: <4992D944.5040108@chamonix.reportlab.co.uk> References: <4992C337.8050602@mesw.de> <4992D944.5040108@chamonix.reportlab.co.uk> Message-ID: <4992E40D.7040506@mesw.de> Robin Becker schrieb: > the original barcode coding was contributed by Ty Sarna, but I have been > maintaining and improving it for a while now. As I understand it ean-5 > is an extension to ean-13 (as is ean-8), but its structure differs > somewhat. I don't think this would take too long, but we're flat out at > present. What a pity! What would be a time frame for your availability? Anyone else? Markus From gherman at darwin.in-berlin.de Wed Feb 11 11:44:14 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 11 Feb 2009 17:44:14 +0100 Subject: [reportlab-users] Paragraphs as chart titles? Message-ID: <2BD2B9CF-FA6B-41FD-954F-E23F8F0CC312@darwin.in-berlin.de> Hi, since it seems to be hard to guarantee that a paragraph and a subsequent chart will not be split by Platypus, I'd like to use multi-line paragraphs (of initially unknown length) as chart titles, but can find only the String shape to add to drawings (where I'd need to do the line wrapping myself). Has anybody found a straightforward way of combining Paragraphs and charts? Thanks, Dinu From andy at reportlab.com Wed Feb 11 12:30:56 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 11 Feb 2009 17:30:56 +0000 Subject: [reportlab-users] Paragraphs as chart titles? In-Reply-To: <2BD2B9CF-FA6B-41FD-954F-E23F8F0CC312@darwin.in-berlin.de> References: <2BD2B9CF-FA6B-41FD-954F-E23F8F0CC312@darwin.in-berlin.de> Message-ID: <956003ae0902110930s65f8ba73t89cc75ba06a5a2c2@mail.gmail.com> 2009/2/11 Dinu Gherman : > Has anybody found a straightforward way of combining Paragraphs > and charts? We haven't. With hindsight or time for a rewrite, we would never have distinguished between charts and Platypus objects, but it's too late. However I think there is some kind of label class used for data points which can wrap text if it exceeds the desired width - but without any intra-paragraph formatting. - Andy From gogtesuyash at gmail.com Wed Feb 11 22:56:42 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Thu, 12 Feb 2009 09:26:42 +0530 Subject: [reportlab-users] How to add two flowables horizontally In-Reply-To: <7d9c65800902110530q5a3ecb9ex8684e4c1b5cb2570@mail.gmail.com> References: <5797af200902110250q9eb1126nd66ecd099ea1638b@mail.gmail.com> <7d9c65800902110333v2d63d289o19070e5b86f03d35@mail.gmail.com> <5797af200902110434k4b1f0f84k42e7135f25bae109@mail.gmail.com> <7d9c65800902110530q5a3ecb9ex8684e4c1b5cb2570@mail.gmail.com> Message-ID: <5797af200902111956p245eb99cx765b8ac01f575f42@mail.gmail.com> yes we can use style but its only for data or contents of the table...we can align content of cell..using above styles...but i want to align table... On Wed, Feb 11, 2009 at 7:00 PM, Wietse Jacobs wrote: > 2009/2/11 Suyash Gogte : > > thnks its working but can u plz tell me......how to align it means > > for e.g > > > > Global Data : > > That's chapter 7 of the User Guide: "Tables and TableStyles". > > story.append(Table([[chart_obj, table_obj]], style=appropriate_style)) > > with an appropriate appropriate_style, e.g.: > > appropriate_style = [ > ('VALIGN', (0,0), (-1,-1), 'MIDDLE'), > ('ALIGN', (0,0), (0,-1), 'RIGHT'), > ('ALIGN', (1,0), (1,-1), 'LEFT'), > ('GRID', (0,0), (-1,-1), 1, colors.pink), > ] > > -- > --Wietse > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidheath.org Thu Feb 12 08:09:30 2009 From: david at davidheath.org (David Heath) Date: Thu, 12 Feb 2009 13:09:30 +0000 Subject: [reportlab-users] Can I build a PDF from a template - small freelance job? Message-ID: <345b57c50902120509v4e9b1adcpdb0653fa60fbcbc9@mail.gmail.com> On 2/10/09, David Heath wrote: >> some .pdf file called fw2.pdf is merged into the current document and >> then gets something drawn on top. I doubt that there is an out of the >> box solution which pulls up .pdf back to the same level as RML and let >> you change it, but for me the mergePage solved all my templating >> business, as far as graphics or or letterhead or other prefabbed pdf >> stuff goes. > > Great, that sounds like it would do the job. I just need a 'decorative > background' above which I'll add additional content. Due to time pressures, I don't have time to work on this. Are there any experienced reportlab hackers on this list who would be willing to do this as a small freelance job? The requirements are to produce a python script. The script would generate a single-page PDF file used as a postal address wrapper. The script will be given as input a PDF 'template' file plus a plain text JSON of the following structure: { "from": "Gordon Brown, 10 Downing Street, London W1A 1AA, UK", "locale": "us", "to": ["Daniel Jackson", "124 Pleasant St", "Portsmouth", "Hants", "UK"] } locale is either 'us' or 'uk'. For US a US-letter size page should be produced, for UK an A4 page should be produced (this may be determined instead by the input template file). The script will combine the 'template' file and add to it the from and to addresses. I can envisage several possible levels of functionality: 1. in the most basic version, the sender and recipient addresses would be positioned on the page in fixed known positions. This is the least desirable of the three options, but ok if nothing else is possible. 2. in a more sophisticated version, the positioning, bounding box, font size (size, weight, typeface) of the sender and recipient addresses would be supplied as input data in the JSON data structure 3. in the most sophisticated version, the positioning of the sender and recipient addresses would be determined by specially tagged elements or placeholders in the PDF template which would indicate the position, font style and bounding box of the elements. I don't know if (3) is possible at all with reportlab. If you're interested please contact me privately to discuss. Thanks David Heath david at davidheath.org From peter at maubp.freeserve.co.uk Thu Feb 12 08:55:55 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Thu, 12 Feb 2009 13:55:55 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> Message-ID: <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> On Thu, Jan 29, 2009 at 4:38 PM, Andy Robinson wrote: > There are two parts to this. ?First, the shapes hierarchy in > reportlab/graphics would need some extra properties so that > a shape could have link properties. ?This is straightforward for > manually constructed shapes, but ... The list of properties for HTML like output is potentially quite long, see http://www.w3.org/TR/REC-html40/struct/links.html - and would be different for SVG, PDF, ... output. The core two for me are the HREF or URL, and the TITLE (usually rendered as a tooltip). Another interesting one in HTML is the TARGET (useful if you want to have the link open in another window), although for SVG is appear they prefer the new SHOW attribute). There are also things like mouse over, on click etc. What can a PDF (or PS) hyperlink do, or what attributes can is have? There is the link URL itself, but is that it? If we added a dictionary (or object) to the basic shape objects (called "link" or "hyperlink" or whatever) then the user could put as many attributes into the dictionary as they liked. The different render backends would each look at a different subset of these entries. This would be extendible, but for the end user could require different properties to be set depending on the intended output file format. I also feel this dictionary approach would be a departure form current ReportLab style. For example, font properties are not bundled together but are held as multiple properties (fontface, fontsize, ...). Therefore, perhaps we should instead implement just a handful of core link properties. e.g. "href_url" as a string, "href_tooltip" as a string, and perhaps "href_new_window" as a boolean (an HTML image map back end would use target="_blank", an SVG or XML backend might use show="new", while for a PDF this has probably has no real meaning and would be ignored). This could be extended gradually if other attributes were deemed sufficiently important. > Secondly, each renderer would need to do the right thing. > I can see this would be really easy with SVG. > > If you're willing to do a little work on this and contribute > patches for core and SVG back end, we'd be happy to help out and > maybe do the same in PDF in step with it. I've been experimenting with an HTML image map renderer, inspired by Dirk Datzert's approach (see July 2003 email linked to earlier) but with additional support for polygons. It occurs to me that even strings with links could be dealt with here by generating a link region from their bounding box. Other basic ReportLab shapes include the ellipse which is not support by an HTML image map, so a crude polygon approximation may be required for completeness. However, for the moment, my biggest unsolved problem is dealing with group transformations - I expect looking more closely at the existing render backends will help here. Trying to extend renderSVG to cope with links is on my to do list - but it would help to have an idea of how you would prefer to store the extra attributes within the basic shapes (discussed above). Thanks, Peter From cito at online.de Thu Feb 12 11:38:53 2009 From: cito at online.de (Christoph Zwerschke) Date: Thu, 12 Feb 2009 17:38:53 +0100 Subject: [reportlab-users] Problem with importing Image from PIL Message-ID: <4994509D.5040007@online.de> I noticed that in reportlab.lib.utils, the main "import PIL.Image" is done with a fallback to "import Image" if it was installed top-level. That's good. However, there are two more places in the same file which only try "import PIL.Image" and do not try "import Image". These places should use the same fallback or even simpler just use the Image that has already been imported as a global variable. -- Christoph From peter at maubp.freeserve.co.uk Thu Feb 12 18:09:22 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Thu, 12 Feb 2009 23:09:22 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> Message-ID: <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> On Thu, Feb 12, 2009 at 1:55 PM, Peter wrote: > > Trying to extend renderSVG to cope with links is on my to do list - > but it would help to have an idea of how you would prefer to store the > extra attributes within the basic shapes (discussed above). > I've got something with SVG links working here, but I had to make a refinement to this bit of renderSVG.py: #these suggested by Tim Roberts self.svg.setAttribute("xmlns", "http://www.w3.org/2000/svg") self.svg.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink") self.svg.setAttribute("version", "1.0") self.svg.setAttribute("baseProfile", "full") I found my links don't work (currently testing on Firefox 1.5 on Linux) unless I change the "xmlns:link" to read "xmlns:xlink" instead. This change is consistent with most online examples, e.g. the official examples on http://www.w3.org/TR/SVG10/linking.html or http://www.w3.org/TR/SVG/linking.html but some cases of the "wrong" form do crop up via Google. With this fix the http://validator.w3.org/ is also much happier - but still grumbles. Apparently "version" and "baseProfile" shouldn't be there for the currently used doctype. Interestingly renderSVG doesn't specify the doctype, letting python's xml.dom decide, so it could vary with version of python (and I am using python 2.4 on this machine). We should be able to specify them when creating the DOM... Peter From robin at reportlab.com Fri Feb 13 05:01:08 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 13 Feb 2009 10:01:08 +0000 Subject: [reportlab-users] Problem with importing Image from PIL In-Reply-To: <4994509D.5040007@online.de> References: <4994509D.5040007@online.de> Message-ID: <499544E4.5090802@chamonix.reportlab.co.uk> Christoph Zwerschke wrote: > I noticed that in reportlab.lib.utils, the main "import PIL.Image" is > done with a fallback to "import Image" if it was installed top-level. > That's good. > > However, there are two more places in the same file which only try > "import PIL.Image" and do not try "import Image". These places should > use the same fallback or even simpler just use the Image that has > already been imported as a global variable. > > -- Christoph ....... thanks I'll take a look later. -- Robin Becker From henning.vonbargen at arcor.de Sun Feb 15 09:46:28 2009 From: henning.vonbargen at arcor.de (Henning von Bargen) Date: Sun, 15 Feb 2009 15:46:28 +0100 Subject: [reportlab-users] Am I allowed to copy and distribute fonts and images from the RL test suite with wordaxe? Message-ID: <041946CBB1754F50975E8E0BF38F3B6D@max> For the wordaxe hyphenation library (http://sourceforge.net/projects/deco-cow/), I have slightly modified some test scripts from the ReportLab test suite in order to see if these also run with hyphenation enabled or with wordaxe's Paragraph class from wordaxe/rl/NewParagraph.py instead of the original reportlab/platypus/Paragraph.py. Some of these tests reference fonts or images that are no longer part of the ReportLab distribution. This causes the tests to fail.See http://sourceforge.net/tracker/index.php?func=detail&aid=2599961&group_id=105867&atid=642478 http://sourceforge.net/tracker/index.php?func=detail&aid=2599892&group_id=105867&atid=642478 Am I allowed to copy the missing resource files for the LeERC___ font and redsquare.png (and possibly others that were part of the ReportlLab test suite) and distribute them with wordaxe? Henning From robin at reportlab.com Sun Feb 15 14:25:28 2009 From: robin at reportlab.com (Robin Becker) Date: Sun, 15 Feb 2009 19:25:28 +0000 Subject: [reportlab-users] Am I allowed to copy and distribute fonts and images from the RL test suite with wordaxe? In-Reply-To: <041946CBB1754F50975E8E0BF38F3B6D@max> References: <041946CBB1754F50975E8E0BF38F3B6D@max> Message-ID: <49986C28.6080506@jessikat.plus.net> Henning von Bargen wrote: > For the wordaxe hyphenation library > (http://sourceforge.net/projects/deco-cow/), > I have slightly modified some test scripts from the ReportLab test suite > in order to see > if these also run with hyphenation enabled or with wordaxe's Paragraph > class from > wordaxe/rl/NewParagraph.py instead of the original > reportlab/platypus/Paragraph.py. > > Some of these tests reference fonts or images that are no longer part of > the ReportLab > distribution. This causes the tests to fail.See > http://sourceforge.net/tracker/index.php?func=detail&aid=2599961&group_id=105867&atid=642478 > > http://sourceforge.net/tracker/index.php?func=detail&aid=2599892&group_id=105867&atid=642478 > ........ I'm not sure; these fonts are certainly still in older revsions of the repository. They were originally contributed to ReportLab by Just van Rossum so perhaps he's the best person to ask. On the other hand is it not possible to substitute the latest fonts which we substituted (ie DarkGarden)? I believe these were added specifically to assist onward distribution at the request of various package maintainers. -- Robin Becker From Robert at jli.com Mon Feb 16 00:56:53 2009 From: Robert at jli.com (Robert D. Young) Date: Sun, 15 Feb 2009 21:56:53 -0800 Subject: [reportlab-users] Platypus Message-ID: Sorry for the re-post, if that's what it is. It's my first posting and I expected to see an ack or copy of the posting and didn't. So I went and changed my settings and now am reposting to make sure it is getting through: ---------------------------- Original Message ---------------------------- Subject: Platypus Date: Fri, February 13, 2009 5:58 pm To: reportlab-users at reportlab.com -------------------------------------------------------------------------- Newbie to reportlab's lib, so trying samples and fail on import of SimpleDocTemplate, which doesn' appear to be in the 2.3 version? I'm using Py 2.6.1 under WinXP and installed the reportlab file 2.3 package for Win32 Python 2.6. Can someone point me o a way to add the platypus parts tht appear to be missong? - Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From cito at online.de Mon Feb 16 01:55:23 2009 From: cito at online.de (Christoph Zwerschke) Date: Mon, 16 Feb 2009 07:55:23 +0100 Subject: [reportlab-users] Platypus In-Reply-To: References: Message-ID: <49990DDB.8000700@online.de> Robert D. Young schrieb: > Newbie to reportlab's lib, so trying samples and fail on import of > SimpleDocTemplate, which doesn' appear to be in the 2.3 version? Did you do the following which is working for me? from reportlab.platypus import SimpleDocTemplate -- Christoph From Robert at jli.com Mon Feb 16 02:22:08 2009 From: Robert at jli.com (Robert D. Young) Date: Sun, 15 Feb 2009 23:22:08 -0800 Subject: [reportlab-users] Platypus In-Reply-To: <49990DDB.8000700@online.de> References: <49990DDB.8000700@online.de> Message-ID: <9844C827DFB94D309C334A9586764851@AbilitySys.local> Doggone it - I thought I had, but retried it just now and - well, i must have been a typo before because it works now! Sorry for the bother. Great product, BTW. - Robert ----- Original Message ----- From: "Christoph Zwerschke" To: "Support list for users of Reportlab software" Sent: Sunday, February 15, 2009 10:55 PM Subject: Re: [reportlab-users] Platypus > Robert D. Young schrieb: >> Newbie to reportlab's lib, so trying samples and fail on import of >> SimpleDocTemplate, which doesn' appear to be in the 2.3 version? > > Did you do the following which is working for me? > > from reportlab.platypus import SimpleDocTemplate > > -- Christoph > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > > From gogtesuyash at gmail.com Mon Feb 16 03:54:49 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Mon, 16 Feb 2009 14:24:49 +0530 Subject: [reportlab-users] Error Message-ID: <5797af200902160054q6321956fj53f06e22bb9b4ffa@mail.gmail.com> hi frnds.. I m getting following error..its run time error at doc.build.... can anybody tell me way to fix it thnks ... Traceback (most recent call last): File "test1.py", line 58, in go() File "test1.py", line 56, in go doc.build(Story, onFirstPage=myFirstPage, onLaterPages=myLaterPages) File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 987, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 756, in build self.handle_flowable(flowables) File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 630, in handle_flowable self.handle_keepWithNext(flowables) File "/usr/local/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 599, in handle_keepWithNext while i From cito at online.de Mon Feb 16 04:25:21 2009 From: cito at online.de (Christoph Zwerschke) Date: Mon, 16 Feb 2009 10:25:21 +0100 Subject: [reportlab-users] Error In-Reply-To: <5797af200902160054q6321956fj53f06e22bb9b4ffa@mail.gmail.com> References: <5797af200902160054q6321956fj53f06e22bb9b4ffa@mail.gmail.com> Message-ID: <49993101.4000709@online.de> Suyash Gogte schrieb: > I m getting following error..its run time error at doc.build.... > can anybody tell me way to fix it Seems you've put a string instead of a Flowable in your story. Wrap the string in a Paragraph or something. -- Christoph From gogtesuyash at gmail.com Mon Feb 16 04:34:01 2009 From: gogtesuyash at gmail.com (Suyash Gogte) Date: Mon, 16 Feb 2009 15:04:01 +0530 Subject: [reportlab-users] Error In-Reply-To: <49993101.4000709@online.de> References: <5797af200902160054q6321956fj53f06e22bb9b4ffa@mail.gmail.com> <49993101.4000709@online.de> Message-ID: <5797af200902160134t19104e21yfece80a80f1abd98@mail.gmail.com> hey Christoph thnks a lot... Now its working by mistake i have used string in flowables... thnks man...... On Mon, Feb 16, 2009 at 2:55 PM, Christoph Zwerschke wrote: > Suyash Gogte schrieb: > > I m getting following error..its run time error at doc.build.... > > can anybody tell me way to fix it > > Seems you've put a string instead of a Flowable in your story. Wrap the > string in a Paragraph or something. > > -- Christoph > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at maubp.freeserve.co.uk Mon Feb 16 07:51:41 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 16 Feb 2009 12:51:41 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> Message-ID: <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> > Apparently "version" and "baseProfile" shouldn't be there for the > currently used doctype. Interestingly renderSVG doesn't specify the > doctype, letting python's xml.dom decide, so it could vary with > version of python (and I am using python 2.4 on this machine). We > should be able to specify them when creating the DOM... My mistake - the current renderSVG.py actually has the doctype hard coded in the save method - it does not handle this via the dom python library. Anyway, attached is my proof of concept updates to renderSVG.py (replacement file and as a patch against https://svn.reportlab.com/svn/public/reportlab/trunk/src/reportlab/graphics/renderSVG.py which I assume it the latest) which allows the use of external hyper-references. All you get to specify are the URL and its title string (tooltip text on most browsers) via two optional properties of the drawing objects. As part of this work I have changed how the doctype is declared, and made sure the new output does pass the W3 validation (the current renderSVG output does not). An example script using this follows below. Peter -------------- from reportlab.graphics import renderPS, renderPDF, renderPM #, renderSVG from reportlab.lib.units import cm from reportlab.graphics import shapes from reportlab.lib import colors import renderSVG_links as renderSVG #my local copy of reportlab.graphics.renderSVG width = 10*cm height = 2*cm #Create very simple drawing object, drawing = shapes.Drawing(width, height) drawing.add(shapes.String(1*cm, 1*cm, "Hello World!", hrefURL = "http://en.wikipedia.org/wiki/Hello_world", hrefTitle = "Why 'Hello World'?", fillColor = colors.darkgreen)) drawing.add(shapes.Rect(4.5*cm, 0.5*cm, 5*cm, 1*cm, hrefURL = "http://en.wikipedia.org/wiki/Rectangle", hrefTitle = "Wikipedia page on rectangles", strokeColor = colors.blue, fillColor = colors.red)) drawing.add(shapes.Ellipse(7*cm, 1*cm, 2*cm, 0.95*cm, hrefURL = "http://en.wikipedia.org/wiki/Ellipse", strokeColor = colors.black, fillColor = colors.yellow)) drawing.add(shapes.Circle(7*cm, 1*cm, 0.9*cm, hrefURL = "http://en.wikipedia.org/wiki/Circle", strokeColor = colors.black, fillColor = colors.brown)) drawing.add(shapes.Ellipse(7*cm, 1*cm, 0.5*cm, 0.9*cm, hrefTitle = "Tooltip with no link? Does nothing!", strokeColor = colors.black, fillColor = colors.black)) drawing.add(shapes.Polygon([4.5*cm, 1.25*cm, 5*cm, 0.1*cm, 4*cm, 0.1*cm], hrefURL = "http://en.wikipedia.org/wiki/Polygon", hrefTitle = "This triangle is a simple polygon.", strokeColor = colors.darkgreen, fillColor = colors.green)) if True : print "Rotating the drawing... to check this all works still ;)" group = drawing.asGroup() group.rotate(90) #rotates about top left corner group.translate(0, -2*cm) drawing = shapes.Drawing(height, width) drawing.add(group) renderPDF.drawToFile(drawing, "hello.pdf") renderPS.drawToFile(drawing, "hello.ps") renderPM.drawToFile(drawing, "hello.png", "PNG") renderSVG.drawToFile(drawing, "hello.svg") print "-" * 50 print renderSVG.drawToString(drawing) print "-" * 50 print "Done" From robin at reportlab.com Mon Feb 16 08:09:18 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 16 Feb 2009 13:09:18 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> Message-ID: <4999657E.1050506@chamonix.reportlab.co.uk> Peter wrote: ............. > Anyway, attached is my proof of concept updates to renderSVG.py > (replacement file and as a patch against > https://svn.reportlab.com/svn/public/reportlab/trunk/src/reportlab/graphics/renderSVG.py > which I assume it the latest) which allows the use of external > hyper-references. All you get to specify are the URL and its title > string (tooltip text on most browsers) via two optional properties of > the drawing objects. > did you forget to attach your replacement? I did not see it? > As part of this work I have changed how the doctype is declared, and > made sure the new output does pass the W3 validation (the current > renderSVG output does not). > > An example script using this follows below. > ....... -- Robin Becker From peter at maubp.freeserve.co.uk Mon Feb 16 08:30:12 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 16 Feb 2009 13:30:12 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <4999657E.1050506@chamonix.reportlab.co.uk> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> <4999657E.1050506@chamonix.reportlab.co.uk> Message-ID: <320fb6e00902160530y414c939dj2053e54018303cfe@mail.gmail.com> > > did you forget to attach your replacement? I did not see it? > Yes, sorry :( Second attempt... Peter -------------- next part -------------- A non-text attachment was scrubbed... Name: svg_links.patch Type: application/octet-stream Size: 8373 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: renderSVG_links.py Type: text/x-script.phyton Size: 30955 bytes Desc: not available Url : From peter at maubp.freeserve.co.uk Mon Feb 16 11:11:13 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 16 Feb 2009 16:11:13 +0000 Subject: [reportlab-users] SVG font-size values lack units (invalid CSS) Message-ID: <320fb6e00902160811jb151383g617c040a9035d712@mail.gmail.com> I noticed that font sizes were not working consistently across viewers, and eventually identified the problem. Firefox 3.0 and Opera 9.20 will ignore a font-size in a style attribute if it has no units (this is considered invalid CSS), showing text in its default size. On the other hand, Safari 3.2.1, Adobe Illustrator CS3 and Mac OS X 10.5 preview will tolerate the missing units, and show the images as I expected (arguably buggy behaviour). See https://bugzilla.mozilla.org/show_bug.cgi?id=311569 for a discussion of this. Currently renderSVG outputs this kind of invalid CSS in its SVG files, Hello World! This should be: Hello World! Or, instead of using the style attribute we could use the font-size attribute where the units are optional, e.g. Hello World! My suggested fix is to update renderSVG.py to replace this: def setFont(self, font, fontSize): if self._font != font or self._fontSize != fontSize: self._font, self._fontSize = (font, fontSize) self.style['font-family'] = font self.style['font-size'] = fontSize with this: def setFont(self, font, fontSize): if self._font != font or self._fontSize != fontSize: self._font, self._fontSize = (font, fontSize) self.style['font-family'] = font #The style attribute contains CSS, so the units are required: self.style['font-size'] = "%ipt" % fontSize The images don't look identical to those from the PNG output from renderPM (the fonts sizes differ a little), but this does look pretty close and it now works on all the browsers I have tested. Peter From peter at maubp.freeserve.co.uk Mon Feb 16 12:23:20 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 16 Feb 2009 17:23:20 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902160530y414c939dj2053e54018303cfe@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> <4999657E.1050506@chamonix.reportlab.co.uk> <320fb6e00902160530y414c939dj2053e54018303cfe@mail.gmail.com> Message-ID: <320fb6e00902160923o7d609de9s903d9ea99db736a3@mail.gmail.com> I see this is in your SVN repository now :) https://svn.reportlab.com/svn/public/reportlab/trunk/src/reportlab/graphics/renderSVG.py [As an aside, I don't suppose you could turn tweak the website to let it show the history too? I find the revision log very helpful in other projects, especially if it includes tags/labels for official releases.] I'm pleased to report that in addition to the previous tests using Opera, Firefox and Safari on the Mac, I have now also tested this on Windows XP using IE 6.0 with either Adobe SVG Viewer (ASV) 6.0 beta, or Examotion's current IE SVG plugin (version 1.1.1). Clickable links are also working in IE6 with either of these plugins (except for the annoying extra "Click to activate and use this control" step from Microsoft avoiding the Eolas patent) with the new renderSVG.py file :) http://www.adobe.com/svg/viewer/install/beta.html http://www.examotion.com Peter From haraldarminmassa at gmail.com Mon Feb 16 12:25:42 2009 From: haraldarminmassa at gmail.com (Harald Armin Massa) Date: Mon, 16 Feb 2009 18:25:42 +0100 Subject: [reportlab-users] Wordaxe 0.3.0, ReportLab 2.2: Assertion Failure, cannot understand why this has to be asserted... Message-ID: <7be3f35d0902160925m56e3c9ebo8be49a838e493f3d@mail.gmail.com> hello, while running a document in preparation for updating wordaxe / reportlab, I get the Assertion failure: Assertion failure self.width=429.536000 nFrags=31 printrange=0:31 printwidth=431.760000 0 SW() 0 1 SP( ) 2.224 2 SW(wegen) 23.568 3 SP( ) 2.224 4 SW(Sch?den,) 33.8 5 SP( ) 2.224 6 SW(die) 10.672 7 SP( ) 2.224 8 SW(der) 11.56 9 SP( ) 2.224 10 SW(Versicherungsnehmer,) 80.472 11 SP( ) 2.224 12 SW(ein) 10.672 13 SP( ) 2.224 14 SW(Mitversicherter) 52.448 15 SP( ) 2.224 16 SW(oder) 16.008 17 SP( ) 2.224 18 SW(eine) 15.12 19 SP( ) 2.224 20 SW(von) 12.896 21 SP( ) 2.224 22 SW(ihnen) 19.568 23 SP( ) 2.224 24 SW(bestellte) 29.792 25 SP( ) 2.224 26 SW(oder) 16.008 27 SP( ) 2.224 28 SW(beauftragte) 40.472 29 SP( ) 2.224 30 SW(Person) 25.344 asserted was: if not abs(self.width - sum(getattr(f,"width",0) for f in fragments[print_indx_start:print_indx_end])) <= 1e-5: and I a have no Idea WHY this get's asserted. My "first look" understanding is that this is checking that floating point errors stay below some point, but... what is the bigger idea behind this? best wishes Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - EuroPython 2009 will take place in Birmingham - Stay tuned! From robin at reportlab.com Mon Feb 16 12:50:34 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 16 Feb 2009 17:50:34 +0000 Subject: [reportlab-users] Wordaxe 0.3.0, ReportLab 2.2: Assertion Failure, cannot understand why this has to be asserted... In-Reply-To: <7be3f35d0902160925m56e3c9ebo8be49a838e493f3d@mail.gmail.com> References: <7be3f35d0902160925m56e3c9ebo8be49a838e493f3d@mail.gmail.com> Message-ID: <4999A76A.4030701@chamonix.reportlab.co.uk> Harald Armin Massa wrote: > hello, > > while running a document in preparation for updating wordaxe / > reportlab, I get the Assertion failure: > > Assertion failure > self.width=429.536000 > nFrags=31 > printrange=0:31 > printwidth=431.760000 > 0 SW() 0 > 1 SP( ) 2.224 > 2 SW(wegen) 23.568 > 3 SP( ) 2.224 > 4 SW(Sch?den,) 33.8 > 5 SP( ) 2.224 > 6 SW(die) 10.672 > 7 SP( ) 2.224 > 8 SW(der) 11.56 > 9 SP( ) 2.224 > 10 SW(Versicherungsnehmer,) 80.472 > 11 SP( ) 2.224 > 12 SW(ein) 10.672 > 13 SP( ) 2.224 > 14 SW(Mitversicherter) 52.448 > 15 SP( ) 2.224 > 16 SW(oder) 16.008 > 17 SP( ) 2.224 > 18 SW(eine) 15.12 > 19 SP( ) 2.224 > 20 SW(von) 12.896 > 21 SP( ) 2.224 > 22 SW(ihnen) 19.568 > 23 SP( ) 2.224 > 24 SW(bestellte) 29.792 > 25 SP( ) 2.224 > 26 SW(oder) 16.008 > 27 SP( ) 2.224 > 28 SW(beauftragte) 40.472 > 29 SP( ) 2.224 > 30 SW(Person) 25.344 > > asserted was: > > if not abs(self.width - sum(getattr(f,"width",0) for f in > fragments[print_indx_start:print_indx_end])) <= 1e-5: > > and I a have no Idea WHY this get's asserted. My "first look" > understanding is that this is checking that floating point errors stay > below some point, but... what is the bigger idea behind this? > > best wishes > > Harald > I believe there was some awful hackery around reconstructing texts when paragraphs get split. Even when the new paragraph was supposed to fit it sometimes didn't because of slight differences in accumulation errors etc etc. The above looks like a sanity check for seeing if the current set of fragments actually fits on the line. However, since that code isn't currently part of our paragraph I can't be totally sure. -- Robin Becker From robin at reportlab.com Mon Feb 16 12:59:08 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 16 Feb 2009 17:59:08 +0000 Subject: [reportlab-users] SVG font-size values lack units (invalid CSS) In-Reply-To: <320fb6e00902160811jb151383g617c040a9035d712@mail.gmail.com> References: <320fb6e00902160811jb151383g617c040a9035d712@mail.gmail.com> Message-ID: <4999A96C.6070502@chamonix.reportlab.co.uk> Peter wrote: ........ > > The images don't look identical to those from the PNG output from > renderPM (the fonts sizes differ a little), but this does look pretty > close and it now works on all the browsers I have tested. > well I just looked at the definitions currently being talked about for svg 1.1 and font-size appears here http://www.w3.org/TR/SVG11/propidx.html there the allowed value types for font-size are | | | | inherit and following the link for length gives this definition > : A length is a distance measurement. The format of a is a optionally followed immediately by a unit identifier. (Note that the specification of a is different for property values than for XML attribute values.) > If the is expressed as a value without a unit identifier (e.g., 48), then the represents a distance in the current user coordinate system. > If one of the unit identifiers is provided (e.g., 12mm), then the is processed according to the description in Units. > Percentage values (e.g., 10%) depend on the particular property or attribute to which the percentage value has been assigned. Two common cases are: (a) when a percentage value represents a percent of the viewport (refer to the section that discusses Units in general), and (b) when a percentage value represents a percent of the bounding box on a given object (refer to the section that describes Object bounding box units). > Within the SVG DOM, a is represented as an SVGLength or an SVGAnimatedLength. I take the definition to allow font-size to be allowed not to be followed by a unit. That said it's not at all obvious how these lengths should be properly interpreted. For PDF the default coordinate system is certainly defined in point units ie 1=1pt. For our bitmaps we decided to make 1 pixel == 1point, but I believe you can specify a dpi value. For SVG I'm not sure. According to http://www.w3.org/TR/SVG11/coords.html#InitialCoordinateSystem the SVG User agent (browser?) is supposed to set up the default view port and the default coordinate system consistently so that 1unit=1pixel. That should be consistent with our current usage. However, looking at the standard examples it's obvious that SVG is not obeying these rules. I believe the default unit should be pixels. Has anyone else got any better ideas? -- Robin Becker From peter at maubp.freeserve.co.uk Mon Feb 16 13:10:47 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 16 Feb 2009 18:10:47 +0000 Subject: [reportlab-users] SVG font-size values lack units (invalid CSS) In-Reply-To: <4999A96C.6070502@chamonix.reportlab.co.uk> References: <320fb6e00902160811jb151383g617c040a9035d712@mail.gmail.com> <4999A96C.6070502@chamonix.reportlab.co.uk> Message-ID: <320fb6e00902161010g8e0096csd60cc237bcea2375@mail.gmail.com> On Mon, Feb 16, 2009 at 5:59 PM, Robin Becker wrote: > > Peter wrote: > ........ >> >> The images don't look identical to those from the PNG output from >> renderPM (the fonts sizes differ a little), but this does look pretty >> close and it now works on all the browsers I have tested. >> > well I just looked at the definitions currently being talked about for svg > 1.1 and font-size appears here > > http://www.w3.org/TR/SVG11/propidx.html > > there the allowed value types for font-size are > > | | | | > inherit > > > and following the link for length gives this definition ... I think you are reading the spec for the font-size attribute where I agree the units are optional, and from me testing all the browsers cope. e.g. Hello World! (I'm not sure what the units used are - this is another reason for us to be explicit if we can be.) The current renderSVG (and my suggested small change) doesn't use the font-size attribute but instead supplies an bit of CSS to the style attribute where units *are* required. e.g Hello World! Peter From andy at reportlab.com Tue Feb 17 02:22:22 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 17 Feb 2009 07:22:22 +0000 Subject: [reportlab-users] Am I allowed to copy and distribute fonts and images from the RL test suite with wordaxe? In-Reply-To: <041946CBB1754F50975E8E0BF38F3B6D@max> References: <041946CBB1754F50975E8E0BF38F3B6D@max> Message-ID: <956003ae0902162322u1a505b07kefe01ae0ab816e8b@mail.gmail.com> 2009/2/15 Henning von Bargen > Am I allowed to copy the missing resource files for the LeERC___ font and > redsquare.png > (and possibly others that were part of the ReportlLab test suite) and > distribute them with > wordaxe? We removed the font because it is not GPL; JvR did NOT give people permission to further modify his font, which is a freedom the Ubuntu folks wanted to include us in their packages. We wanted a font which was very obviously "not Helvetica", so we switched to DarkGarden which fills the same needs for us. Just van Rossum explicitly gave permission for these to be included for testing purposes. If you already wrote a lot of tests based on the metrics of LettError, am sure he won't mind if you keep it there, but you should note in your credits that it is his copyright. I don't know what 'redsquare.png' was (I'm mostly offline this week) but am willing to bet it was a red square PNG we created, so I hereby permit you to redistribute this :-) - Andy From gherman at darwin.in-berlin.de Tue Feb 17 04:18:32 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 17 Feb 2009 10:18:32 +0100 Subject: [reportlab-users] Am I allowed to copy and distribute fonts and images from the RL test suite with wordaxe? In-Reply-To: <956003ae0902162322u1a505b07kefe01ae0ab816e8b@mail.gmail.com> References: <041946CBB1754F50975E8E0BF38F3B6D@max> <956003ae0902162322u1a505b07kefe01ae0ab816e8b@mail.gmail.com> Message-ID: <07AAEB48-6EA4-4049-8BE3-33332A56C723@darwin.in-berlin.de> Andy Robinson: > We removed the font because it is not GPL; JvR did NOT give people > permission to further modify his font, which is a freedom the Ubuntu > folks wanted to include us in their packages. We wanted a font which > was very obviously "not Helvetica", so we switched to DarkGarden which > fills the same needs for us. So RL goes GPL, now? I'm holding my breath... Dinu From H.vonBargen at t-p.com Tue Feb 17 04:46:20 2009 From: H.vonBargen at t-p.com (Henning von Bargen) Date: Tue, 17 Feb 2009 10:46:20 +0100 Subject: [reportlab-users] Wordaxe 0.3.0, ReportLab 2.2: Assertion Failure, cannot understand why... In-Reply-To: Message-ID: <77A9E75DA75C564D82BDC4B18A7D8525305740@ROHRPOSTIX.tup.ads> Harald Armin Massa wrote: > while running a document in preparation for updating wordaxe / > reportlab, I get the Assertion failure: > > Assertion failure > self.width=429.536000 > nFrags=31 > printrange=0:31 > printwidth=431.760000 > 0 SW() 0 > 1 SP( ) 2.224 > 2 SW(wegen) 23.568 > 3 SP( ) 2.224 > 4 SW(Sch?den,) 33.8 ... > 28 SW(beauftragte) 40.472 > 29 SP( ) 2.224 > 30 SW(Person) 25.344 > > asserted was: > > if not abs(self.width - sum(getattr(f,"width",0) for f in > fragments[print_indx_start:print_indx_end])) <= 1e-5: > > and I a have no Idea WHY this get's asserted. My "first look" > understanding is that this is checking that floating point errors stay > below some point, but... what is the bigger idea behind this? Harald, the code you are mentioning is part of wordaxe, not ReportLab. Please file a bug for wordaxe instead of posting to this list next time. But to answer your question: There's no bigger idea. The intention is just as you guessed: When I coded NewParagraph, I assumed that the sum of the fragments' widths should match self.width - since floats are used, the comparison is a bit fuzzy. This is to assure that the paragraph doesn't "write across its border" when finally it will be rendered. Seems like either there's a bug in the wordaxe code or the assertion is wrong. You may try to comment the assertion and carefully look at the generated PDF for this paragraph. Henning From gherman at darwin.in-berlin.de Sat Feb 21 12:44:18 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Sat, 21 Feb 2009 18:44:18 +0100 Subject: [reportlab-users] Sample code for repeating table headers/footers? Message-ID: <33243C82-19C4-42E2-831E-C5D7511549EC@darwin.in-berlin.de> Hi, I cannot find any sample code for repeating header/footer rows in tables? I would be very glad if somebody could point me to such existing code or even post something like that here, since neither the RL User Guide nor the test suite seem to contain such a code samples. Thanks, Dinu From aklaver at comcast.net Sat Feb 21 13:00:07 2009 From: aklaver at comcast.net (Adrian Klaver) Date: Sat, 21 Feb 2009 10:00:07 -0800 Subject: [reportlab-users] Sample code for repeating table headers/footers? In-Reply-To: <33243C82-19C4-42E2-831E-C5D7511549EC@darwin.in-berlin.de> References: <33243C82-19C4-42E2-831E-C5D7511549EC@darwin.in-berlin.de> Message-ID: <200902211000.08414.aklaver@comcast.net> On Saturday 21 February 2009 9:44:18 am Dinu Gherman wrote: > Hi, > > I cannot find any sample code for repeating header/footer rows > in tables? I would be very glad if somebody could point me to > such existing code or even post something like that here, since > neither the RL User Guide nor the test suite seem to contain > such a code samples. > > Thanks, > > Dinu > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users For a header row, straight from the User Guide. Repeats the first row passed to the Table(), in this case the data in dList. tbl = Table(dList,style=TBL_STYLE,colWidths=COL_WIDTHS,repeatRows=1) I have yet to find a footer equivalent for a table. -- Adrian Klaver aklaver at comcast.net From paul.barrass at safeonlinebilling.com Sun Feb 22 09:04:54 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Sun, 22 Feb 2009 14:04:54 +0000 Subject: [reportlab-users] Sample code for repeating table headers/footers? In-Reply-To: <200902211000.08414.aklaver@comcast.net> References: <33243C82-19C4-42E2-831E-C5D7511549EC@darwin.in-berlin.de> <200902211000.08414.aklaver@comcast.net> Message-ID: <49A15B86.9000200@safeonlinebilling.com> Adrian Klaver wrote: > On Saturday 21 February 2009 9:44:18 am Dinu Gherman wrote: > >> Hi, >> >> I cannot find any sample code for repeating header/footer rows >> in tables? > For a header row, straight from the User Guide. Repeats the first row passed to > the Table(), in this case the data in dList. > tbl = Table(dList,style=TBL_STYLE,colWidths=COL_WIDTHS,repeatRows=1) > > I have yet to find a footer equivalent for a table As far as I'm aware, there is no per-page Table footer - however you should be able to adjust the workaround I posted for long table performance a while back ( http://two.pairlist.net/pipermail/reportlab-users/2008-October/007594.html ) to provide a footer as well as a header - though I've never checked to see if this actually works. There would be no need to split the data into multiple Tables unless you needed the performance boost, and that should remove some of the constraints. That suggestion is really an evil gratuitous hack, and you'd probably be a lot better off altering Table to repeat footer rows, but that would probably involve a lot of work updating the styling etc. Paul Barrass. From chris.hoy at hoyc.fsnet.co.uk Tue Feb 24 03:06:13 2009 From: chris.hoy at hoyc.fsnet.co.uk (Chris Hoy) Date: Tue, 24 Feb 2009 08:06:13 -0000 Subject: [reportlab-users] Problem install 2.3 via easy_install on Unbunto Message-ID: <39A6FE6D0D79457FBDDFCF4190A11759@Yellowstone> Hi I?m getting the following error when trying to install ReportLab 2.3 via easy_install, I suspect that I haven?t install all the necessary packages for the complier any help would be appreciated root at prmax01:~# easy_install -U ReportLab Searching for ReportLab Reading http://pypi.python.org/simple/ReportLab/ Reading http://www.reportlab.com/ Best match: reportLab 2.3 Downloading http://pypi.python.org/packages/source/r/reportlab/reportLab-2.3.zip#md5=7d9 8b26fa287a9e4be4d35d682ce64ac Processing reportLab-2.3.zip Running ReportLab_2_3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QsosE7/ReportLab_2_3/egg-dist-tmp-xJI7Vq ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/renderPM' # installing without freetype no ttf, sorry! ################################################ /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function 'hex32': /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:79 3: warning: format '%8.8X' expects type 'unsigned int', but argument 3 has type 'long unsigned int' /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function '_instanceStringWidthU': /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:12 00: warning: pointer targets in assignment differ in signedness /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:11 23: warning: 'f' may be used uninitialized in this function /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:11 23: warning: 't' may be used uninitialized in this function /tmp/easy_install-QsosE7/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:11 23: warning: 'L' may be used uninitialized in this function /usr/bin/ld: cannot find -l_renderPM_libart collect2: ld returned 1 exit status error: Setup script exited with error: command 'gcc' failed with exit status 1 Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Tue Feb 24 03:56:22 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 24 Feb 2009 08:56:22 +0000 Subject: [reportlab-users] Problem install 2.3 via easy_install on Unbunto In-Reply-To: <39A6FE6D0D79457FBDDFCF4190A11759@Yellowstone> References: <39A6FE6D0D79457FBDDFCF4190A11759@Yellowstone> Message-ID: <956003ae0902240056q78a3d6c7xd1f12bda69065c08@mail.gmail.com> 2009/2/24 Chris Hoy : > Hi Hi. Awesome performance in Beijing, by the way! > I?m getting the following error when trying to install ReportLab 2.3 via > easy_install, I suspect that I haven?t install all the necessary packages > for the complier any help would be appreciated We don't currently support easy_install. (Unfortunately, easy_install attempts to support us, but that's the author's problem!). Just download the package and run 'python setup.py install', and all should work. Why is a long story but we laid out our directories, version numbers and build processes long before easy_install was invented and each time we rearrange these things it causes us some pain and takes up a lot of time (for no functionality in return). We might get there on our next major version. Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From peter at maubp.freeserve.co.uk Tue Feb 24 11:41:30 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Tue, 24 Feb 2009 16:41:30 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902160923o7d609de9s903d9ea99db736a3@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902120555i37c3e7c8ibb0332901c81c0b8@mail.gmail.com> <320fb6e00902121509n3233235dlf44cc1ba6604423b@mail.gmail.com> <320fb6e00902160451m190404c4j9afb3e76ee784f5f@mail.gmail.com> <4999657E.1050506@chamonix.reportlab.co.uk> <320fb6e00902160530y414c939dj2053e54018303cfe@mail.gmail.com> <320fb6e00902160923o7d609de9s903d9ea99db736a3@mail.gmail.com> Message-ID: <320fb6e00902240841h71869ed8p2bf397e82622dc83@mail.gmail.com> On Mon, Feb 16, 2009 at 5:23 PM, Peter wrote: > I see this is in your SVN repository now :) I've attached a patch against the current SVN version of renderSVG.py to support making links on closed SVG paths. Without this only the simplest of vector shapes had working links (rectangles, polygons, circles, etc), but by supporting closed paths this lets the user create any complicated shape - and have it linkable :) At the end of the email is an example of how this might get used. Peter -------------- from reportlab.graphics import renderPS, renderPDF, renderSVG, renderPM from reportlab.lib.units import cm from reportlab.graphics import shapes from reportlab.lib import colors width=10*cm height=2*cm #Create fairly simple drawing object, drawing=shapes.Drawing(width, height) p=shapes.ArcPath(strokeColor=colors.darkgreen, fillColor=colors.green, hrefURL="http://en.wikipedia.org/wiki/Vector_path", hrefTitle="This big letter C is actually a closed vector path.", strokewidth=0) p.addArc(1*cm, 1*cm, 0.8*cm, 20, 340, moveTo=True) p.addArc(1*cm, 1*cm, 0.9*cm, 20, 340, reverse=True) p.closePath() drawing.add(p) drawing.add(shapes.Rect(2.25*cm, 0.1*cm, 1.5*cm, 0.8*cm, rx=0.25*cm, ry=0.25*cm, hrefURL="http://en.wikipedia.org/wiki/Rounded_rectangle", hrefTitle="Rounded Rectangle", strokeColor=colors.red, fillColor=colors.yellow)) drawing.add(shapes.String(1*cm, 1*cm, "Hello World!", hrefURL="http://en.wikipedia.org/wiki/Hello_world", hrefTitle="Why 'Hello World'?", fillColor=colors.darkgreen)) drawing.add(shapes.Rect(4.5*cm, 0.5*cm, 5*cm, 1*cm, hrefURL="http://en.wikipedia.org/wiki/Rectangle", hrefTitle="Wikipedia page on rectangles", strokeColor=colors.blue, fillColor=colors.red)) drawing.add(shapes.Ellipse(7*cm, 1*cm, 2*cm, 0.95*cm, hrefURL="http://en.wikipedia.org/wiki/Ellipse", strokeColor=colors.black, fillColor=colors.yellow)) drawing.add(shapes.Circle(7*cm, 1*cm, 0.9*cm, hrefURL="http://en.wikipedia.org/wiki/Circle", strokeColor=colors.black, fillColor=colors.brown)) drawing.add(shapes.Ellipse(7*cm, 1*cm, 0.5*cm, 0.9*cm, hrefTitle="Tooltip with no link?", strokeColor=colors.black, fillColor=colors.black)) drawing.add(shapes.Polygon([4.5*cm, 1.25*cm, 5*cm, 0.1*cm, 4*cm, 0.1*cm], hrefURL="http://en.wikipedia.org/wiki/Polygon", hrefTitle="This triangle is a simple polygon.", strokeColor=colors.darkgreen, fillColor=colors.green)) renderPDF.drawToFile(drawing, "hello.pdf") renderPS.drawToFile(drawing, "hello.ps") renderSVG.drawToFile(drawing, "hello.svg") renderPM.drawToFile(drawing, "hello.png", "PNG") print "-" * 50 print renderSVG.drawToString(drawing) print "-" * 50 print "Done" -------------- next part -------------- A non-text attachment was scrubbed... Name: svg_link_closed_paths.patch Type: application/octet-stream Size: 1425 bytes Desc: not available Url : From robin at reportlab.com Tue Feb 24 12:07:24 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 24 Feb 2009 17:07:24 +0000 Subject: [reportlab-users] jython25 branch Message-ID: <49A4294C.8080001@chamonix.reportlab.co.uk> Hi, I've created a jython25 branch in the public repository at http://svn.reportlab.com/svn/public/reportlab/branches/jython25/src I've tested this with jython2.5b1 and it is mostly working. Clearly there are some issues with image handling etc etc as we don't have PIL, but there are only a few test failures. I'm glad to say that ttf fonts can now be used as in ordinary python based ReportLab. -- Robin Becker From peter at maubp.freeserve.co.uk Tue Feb 24 12:42:28 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Tue, 24 Feb 2009 17:42:28 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> Message-ID: <320fb6e00902240942g264848bfta23eb143b0c6331e@mail.gmail.com> On Thu, Jan 29, 2009 at 4:38 PM, Andy Robinson wrote: > > 2009/1/29 Peter : >> I imagine there are parallels here with PDF output, which can in >> theory also include externals URLs. ?Is any of this currently possible >> in ReportLab? ?I've been looking over the documentation and the source >> code, but have concluded that it is not yet supported. > > No. ? A few people have asked us about charts with click-throughs > and drill-downs, but we never did it. > > There are two parts to this. ?First, the shapes hierarchy in > reportlab/graphics would need some extra properties so that > a shape could have link properties. ?This is straightforward for > manually constructed shapes, but presumably for charts one > would need to allow some subclass or callback mechanism so the caller > can define what URLs a data point or bar would link to. What's in SVN now defines two optional attributes on the shape objects, hrefURL and hrefTitle, which do nothing unless the render code is aware of them. > Secondly, each renderer would need to do the right thing. > I can see this would be really easy with SVG. Yes, this does now seem to be working pretty well for SVG. > If you're willing to do a little work on this and contribute > patches for core and SVG back end, we'd be happy to help out and > maybe do the same in PDF in step with it. I've been looking at ReportLab's PDF code, in particular the PDF canvas object (which lives in reportlab/pdfgen/canvas.py rather than reportlab/graphics/renderPDF.py) and see there is some code for "PDF Actions" (a rather general feature which includes linking to an external URL, or URI as Adobe seem to prefer). In the PDF canvas linkURL method a "PDF Action" is associated with an invisible "PDF Annotation", which is a rectangular region. If am I reading the code right, this "link region" has to be a rectangle - it can't be a rotated rectangle where the edges are not parallel to the page edges. Can a "PDF Action" be attached to an ordinary shape, like a visible (rotated) rectangle, or any closed path? Peter From robin at reportlab.com Tue Feb 24 13:05:16 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 24 Feb 2009 18:05:16 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <320fb6e00902240942g264848bfta23eb143b0c6331e@mail.gmail.com> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902240942g264848bfta23eb143b0c6331e@mail.gmail.com> Message-ID: <49A436DC.10902@chamonix.reportlab.co.uk> ....... > > I've been looking at ReportLab's PDF code, in particular the PDF > canvas object (which lives in reportlab/pdfgen/canvas.py rather than > reportlab/graphics/renderPDF.py) and see there is some code for "PDF > Actions" (a rather general feature which includes linking to an > external URL, or URI as Adobe seem to prefer). In the PDF canvas > linkURL method a "PDF Action" is associated with an invisible "PDF > Annotation", which is a rectangular region. If am I reading the code > right, this "link region" has to be a rectangle - it can't be a > rotated rectangle where the edges are not parallel to the page edges. > Can a "PDF Action" be attached to an ordinary shape, like a visible > (rotated) rectangle, or any closed path? > > Peter ........ my reading of the latest link annotation dictionary definition seems to indicate that it can be a rectangle /Rect entry or > QuadPoints > array > (Optional; PDF 1.6) An array of 8 ? n numbers specifying the coordinates of nquadrilaterals in default user space that comprise the region in which the link should be activated. The coordinates for each quadrilateral are given in the order > x1 y1 x2 y2 x3 y3 x4 y4 > specifying the four vertices of the quadrilateral in counterclockwise order. For orientation purposes, such as when applying an underline border style, the bottom of a quadrilateral is the line formed by (x1 , y1) and (x2 , y2). > If this entry is not present or the viewer application does not recognize it, the region specified by the Rect entry should be used. QuadPoints should be ignored > if any coordinate in the array lies outside the region specified by Rect. it doesn't look like you can get a generic path region as the clickable. -- Robin Becker From peter at maubp.freeserve.co.uk Tue Feb 24 13:22:03 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Tue, 24 Feb 2009 18:22:03 +0000 Subject: [reportlab-users] External hyperlinks in SVG output In-Reply-To: <49A436DC.10902@chamonix.reportlab.co.uk> References: <320fb6e00901290737k1269fb4en92975edbcf87f88a@mail.gmail.com> <956003ae0901290838g6393c59dxb36e52626ff6429c@mail.gmail.com> <320fb6e00902240942g264848bfta23eb143b0c6331e@mail.gmail.com> <49A436DC.10902@chamonix.reportlab.co.uk> Message-ID: <320fb6e00902241022h7136fd32j2382cdd39de4834f@mail.gmail.com> On Tue, Feb 24, 2009 at 6:05 PM, Robin Becker wrote: > > my reading of the latest link annotation dictionary definition seems to > indicate that it can be a rectangle /Rect entry or > >> QuadPoints >> array >> (Optional; PDF 1.6) An array of 8 ? n numbers specifying the coordinates >> of nquadrilaterals in default user space that comprise the region in which >> the link should be activated. The coordinates for each quadrilateral are >> given in the order x1 y1 x2 y2 x3 y3 x4 y4 specifying the four vertices of >> the quadrilateral in counterclockwise order. For orientation purposes, >> such as when applying an underline border style, the bottom of a >> quadrilateral is the line formed by (x1 , y1) and (x2 , y2). >> If this entry is not present or the viewer application does not recognize it, >> the region specified by the Rect entry should be used. QuadPoints should >> be ignored if any coordinate in the array lies outside the region specified >> by Rect. > > it doesn't look like you can get a generic path region as the clickable. Thanks for the information - that is at least better than just non-rotated rectangular regions. What version of PDF does ReportLab normally generate? If we can use the QuadPoints feature that would support the ReportLab shapes.Rect nicely (at any rotation or other translation), and polygons with four points. Triangles (polygons with three points) should also be easy. Other shapes would have to be approximated (ugly), given as the bounding rectangle (simple), or not supported at all... Does any of this apply to PostScript? I know you can embed some PDF stuff into PostScript, but I haven't looked at the details of renderPS.py to see how ReportLab does this. Thanks, Peter From chris.hoy at hoyc.fsnet.co.uk Wed Feb 25 03:35:00 2009 From: chris.hoy at hoyc.fsnet.co.uk (Chris Hoy) Date: Wed, 25 Feb 2009 08:35:00 -0000 Subject: [reportlab-users] Problem install 2.3 via easy_install on Unbunto In-Reply-To: <956003ae0902240056q78a3d6c7xd1f12bda69065c08@mail.gmail.com> References: <39A6FE6D0D79457FBDDFCF4190A11759@Yellowstone> <956003ae0902240056q78a3d6c7xd1f12bda69065c08@mail.gmail.com> Message-ID: <578C90B806B14DF5825849A06877FF4D@Yellowstone> Hi Andy Thank, installed and working fine Chris >> Hi. Awesome performance in Beijing, by the way! >> >> >> I?m getting the following error when trying to install ReportLab 2.3 via >> easy_install, I suspect that I haven?t install all the necessary packages >> for the complier any help would be appreciated >> We don't currently support easy_install. (Unfortunately, easy_install >> attempts >> to support us, but that's the author's problem!). Just download the package and >> run 'python setup.py install', and all should work. >> Why is a long story but we laid out our directories, version numbers >> and build processes long before easy_install was invented and each time >> we rearrange these things it causes us some pain and takes up a lot of >> time >> (for no functionality in return). We might get there on our next >> major version. >> Best Regards, >> -- >> Andy Robinson >> CEO/Chief Architect >> ReportLab Europe Ltd. >> Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK >> Tel +44-20-8545-1570 No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.3/1970 - Release Date: 02/24/09 13:35:00 From gherman at darwin.in-berlin.de Thu Feb 26 06:02:27 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 26 Feb 2009 12:02:27 +0100 Subject: [reportlab-users] Tons of table questions Message-ID: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> Hi, I guess this is the main (FAQ one) to start with... How can I make tables render more quickly? From my experiments it seems that tables are rendered roughly in O(n^2) with n being the number of rows (in my current example 1000 rows take a minute, but 10 x 100 take 6 seconds). Does it have to be like that? What can be done against it? Do plain strings instead of Paragraphs help? Does it help to preset all col- umn widths with fixed values? Is the LongTable class the solution? Also, is there any useful sample code / test / documentation for the splitlast/splitfirst features in tables that one can understand without digging into mail archives, only to find that it likely is not working as it should? And finally, is there a workaround to speedup table rendering by splitting it into little chunks and concatenating them? In order for that to work one would need a table header that is shown only at the beginning of a new frame. Is that realistic? Regards, Dinu From robin at reportlab.com Thu Feb 26 06:29:29 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 26 Feb 2009 11:29:29 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> Message-ID: <49A67D19.5080806@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Hi, > > I guess this is the main (FAQ one) to start with... How can I make > tables render more quickly? > > From my experiments it seems that tables are rendered roughly in > O(n^2) with n being the number of rows (in my current example 1000 > rows take a minute, but 10 x 100 take 6 seconds). > > Does it have to be like that? What can be done against it? Do plain > strings instead of Paragraphs help? Does it help to preset all col- > umn widths with fixed values? Is the LongTable class the solution? > > Also, is there any useful sample code / test / documentation for > the splitlast/splitfirst features in tables that one can understand > without digging into mail archives, only to find that it likely > is not working as it should? > > And finally, is there a workaround to speedup table rendering by > splitting it into little chunks and concatenating them? In order > for that to work one would need a table header that is shown only > at the beginning of a new frame. Is that realistic? > > Regards, > > Dinu Dinu there was a long discussion about table times a few years ago. In particular there was a longTable speedup proposed and contributed by Henning von Bargen. That was about 5 years ago. In rl_config.py there's a variable to turn this optimisation on and off for the default Table class. If you set it to one in your local_rl_config then you should get rid of the n**2 behaviour. -- Robin Becker From paul.barrass at safeonlinebilling.com Thu Feb 26 06:32:13 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 26 Feb 2009 11:32:13 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> Message-ID: <49A67DBD.8060406@safeonlinebilling.com> Dinu Gherman wrote: > Hi, > > I guess this is the main (FAQ one) to start with... How can I make > tables render more quickly? I refer you again to my earlier post http://two.pairlist.net/pipermail/reportlab-users/2008-October/007594.html [Potential workaround for performance issues on VERY long tables.], and the thread cited in that post http://two.pairlist.net/pipermail/reportlab-users/2004-May/003019.html [Large tables - exponentially increasing run times] which discusses the O(n^2) behaviour. Both posts suggest that the idea is worth making a note of in the documentation. > > Do plain strings instead of Paragraphs help? I've found that plain text rather than Paragraphs leads to an approximate doubling of rendering speed, I've also found that the extra flexibility obtained by using a Paragraph (most notably word-wrapping, but also more control over styling etc.) is worth the extra time, but YMMV > Does it help to preset all column widths with fixed values? Is the > LongTable class the solution? I've always used fixed-width tables, so can't really comment from experience, though I think the LongTable class works to improve performance on the width-setting stage of Table generation. > And finally, is there a workaround to speedup table rendering by > splitting it into little chunks and concatenating them? In order > for that to work one would need a table header that is shown only > at the beginning of a new frame. Is that realistic? This is, or at least was in 2004, the way to do it. I'm not sure if any improvements to the Table splitting code have been made since then. My workaround of wrapping the fragments in a PTOContainer allows table headers (and I guess footers) to be used when the Table is split between pages. Paul Barrass. From gherman at darwin.in-berlin.de Thu Feb 26 06:41:24 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 26 Feb 2009 12:41:24 +0100 Subject: [reportlab-users] Tons of table questions In-Reply-To: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> Message-ID: I wrote: > Is the LongTable class the solution? Thanks for the answers so far! I also found that LongTable saves me about an order of magnitude of time, but otherwise still be- haves more like O(n^2) than like O(n)... I'll try using less Paragraphs and more fixed column widths... Regards, Dinu From paul.barrass at safeonlinebilling.com Thu Feb 26 06:48:14 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 26 Feb 2009 11:48:14 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: <49A67D19.5080806@chamonix.reportlab.co.uk> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> <49A67D19.5080806@chamonix.reportlab.co.uk> Message-ID: <49A6817E.5030407@safeonlinebilling.com> Robin Becker wrote: > Dinu there was a long discussion about table times a few years ago. In > particular there was a longTable speedup proposed and contributed by > Henning von Bargen. That was about 5 years ago. In rl_config.py > there's a variable to turn this optimisation on and off for the > default Table class. If you set it to one in your local_rl_config then > you should get rid of the n**2 behaviour. In my experience with long tables, I've found the non-linear behaviour both with and without LongTable() - I think the LongTable optimisation optimises the calculation of /where/ to split (which can improve performance where cell widths/heights are variable) but the non-linear behaviour is occurring during the actual splitting, where LongTable is identical to Table. Paul Barrass. From robin at reportlab.com Thu Feb 26 07:14:59 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 26 Feb 2009 12:14:59 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: <49A6817E.5030407@safeonlinebilling.com> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> <49A67D19.5080806@chamonix.reportlab.co.uk> <49A6817E.5030407@safeonlinebilling.com> Message-ID: <49A687C3.2000202@chamonix.reportlab.co.uk> Paul Barrass wrote: > Robin Becker wrote: >> Dinu there was a long discussion about table times a few years ago. In >> particular there was a longTable speedup proposed and contributed by >> Henning von Bargen. That was about 5 years ago. In rl_config.py >> there's a variable to turn this optimisation on and off for the >> default Table class. If you set it to one in your local_rl_config then >> you should get rid of the n**2 behaviour. > In my experience with long tables, I've found the non-linear behaviour > both with and without LongTable() - I think the LongTable optimisation > optimises the calculation of /where/ to split (which can improve > performance where cell widths/heights are variable) but the non-linear > behaviour is occurring during the actual splitting, where LongTable is > identical to Table. > ...... yes there's bound to be an element of n**2 since the split has to create the new table from the old by copying. We currently don't have the concept of a view into the table data. The original problem which the longTable optimisation addressed was that we scanned the whole table each time again rather than splitting early. -- Robin Becker From robin at reportlab.com Thu Feb 26 07:20:10 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 26 Feb 2009 12:20:10 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: <49A6817E.5030407@safeonlinebilling.com> References: <27F3B42F-D09E-451F-B323-475C2AEDBC18@darwin.in-berlin.de> <49A67D19.5080806@chamonix.reportlab.co.uk> <49A6817E.5030407@safeonlinebilling.com> Message-ID: <49A688FA.8040309@chamonix.reportlab.co.uk> I guess we could imagine a two pass algorithm where the first pass O(n) gathers overall width height data and accumulates stuff for a second pass which then lays out the data using a slice of the original data that's left to be rendered and does no copying at all of data or styles. -- Robin Becker From H.vonBargen at t-p.com Thu Feb 26 07:53:22 2009 From: H.vonBargen at t-p.com (Henning von Bargen) Date: Thu, 26 Feb 2009 13:53:22 +0100 Subject: [reportlab-users] Tons of table questions In-Reply-To: Message-ID: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> > From: Robin Becker > Subject: Re: [reportlab-users] Tons of table questions > > I guess we could imagine a two pass algorithm where the first > pass O(n) gathers > overall width height data and accumulates stuff for a > second pass which then > lays out the data using a slice of the original data that's > left to be rendered > and does no copying at all of data or styles. > -- > Robin Becker I guess that further optimization requires additional conditions: 1) The first and all the following frames have to be of the same width. 2) Possibly: ... the same height. But for long tables, at least condition 1) should be no problem for real-world applications. Henning From gherman at darwin.in-berlin.de Thu Feb 26 08:12:55 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 26 Feb 2009 14:12:55 +0100 Subject: [reportlab-users] Tons of table questions In-Reply-To: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> Message-ID: Henning von Bargen: > I guess that further optimization requires additional conditions: > 1) The first and all the following frames have to be of the same > width. > 2) Possibly: ... the same height. > > But for long tables, at least condition 1) should be no problem > for real-world applications. I think both conditions are very realistic in practice. But even without them I cannot see any non-linearity re- lated to the problem itself. So, maybe an implementation using generators might solve this? Dinu From robin at reportlab.com Thu Feb 26 09:01:14 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 26 Feb 2009 14:01:14 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> Message-ID: <49A6A0AA.5000805@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Henning von Bargen: > >> I guess that further optimization requires additional conditions: >> 1) The first and all the following frames have to be of the same width. >> 2) Possibly: ... the same height. >> >> But for long tables, at least condition 1) should be no problem >> for real-world applications. > > I think both conditions are very realistic in practice. > But even without them I cannot see any non-linearity re- > lated to the problem itself. So, maybe an implementation > using generators might solve this? > > Dinu ....... I don't think it much matters whether you use generators or something else to hold the actual data. What matters is to reduce or eliminate the copying. The longTable n**2 problem relates to copying the data which is of order n-m where m is the number of data rows already dealt with. Since you need to do that operation some fraction of n times you get a term in (n-p) + n-2p + n-3p ..... which sums to O(n**2). By putting the tail of the data into a generator (+a lookahead buffer for the bits discarded by the current table) the n-m term is indeed reduced, but you still have to copy the data around. So the split would look like T0(B=[],G) --> T1(B=[1...p],None) + T2(B=[p+1,..],G) where B represent s a buffer of rows popped from the generator, but not yet rendered and G represents the tail of the data. Clearly you have to copy the [p+1,..p+x] rows that are unused from T1. Hopefully this copying is small (say only one overflow row). If you use a data array or simulation thereof you can represent the split as T0(1,len(A),A) --> T1(1,p,A) + T2(p+1,len(A),A) so no copying is required, but we change the view indices as we go forward. -- Robin Becker From gherman at darwin.in-berlin.de Thu Feb 26 09:56:32 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 26 Feb 2009 15:56:32 +0100 Subject: [reportlab-users] Tons of table questions In-Reply-To: <49A6A0AA.5000805@chamonix.reportlab.co.uk> References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> <49A6A0AA.5000805@chamonix.reportlab.co.uk> Message-ID: <7038B056-81E3-48E5-831B-473DE3F66B43@darwin.in-berlin.de> Robin Becker: > [...] so no copying is required, but we change the view > indices as we go forward. Thanks for the analysis! In essence, yes, the solution would be to use the appropriate datastructure. Could you add this to your bug tracker, as a design change request or as whatever is appropriate to RL? Thanks, Dinu From andy at reportlab.com Thu Feb 26 11:46:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 26 Feb 2009 16:46:25 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> Message-ID: <956003ae0902260846r383a076bl13278d70cc2de72e@mail.gmail.com> 2009/2/26 Dinu Gherman : > I think both conditions are very realistic in practice. > But even without them I cannot see any non-linearity re- > lated to the problem itself. So, maybe an implementation > using generators might solve this? The non-linearity is as follows. If you make a big table with, say, 1000 rows x 10 cols, and space for 40 rows on each page, and specify no widths to help us, then we have to size every table cell - that's 10,000 objects. We then work out the optimal column widths for the present page. We then say "OK, I can only fit about 40 rows on this page", and we split it into a 40- row table and a 960-row table. Then, on the next page, we start again, this time sizing 9600 cells. But this page might have a different frame width, so we just dumbly start again and recalculate all those table cell sizes. I don't know the maths but the scaling is probably the same as the song "ten green bottles, hanging on the wall" or the "twelve days of Christmas". AFAIR the LongTable optimisation works by just looking at the first few rows to work out the column widths. Smarter implementations are certainly possible but I would urge people to just create a bunch of smaller tables in the first place. If you are outputting thousands of rows, you probably have some kind of grouping mechanism or want headers and footers anyway, and it's easiest to style things AND faster to render if you use a separate table for each visually similar slab of content. - Andy From gherman at darwin.in-berlin.de Thu Feb 26 15:44:19 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 26 Feb 2009 21:44:19 +0100 Subject: [reportlab-users] Tons of table questions In-Reply-To: <956003ae0902260846r383a076bl13278d70cc2de72e@mail.gmail.com> References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> <956003ae0902260846r383a076bl13278d70cc2de72e@mail.gmail.com> Message-ID: Andy Robinson: > The non-linearity is as follows. If you make a big table with, > say, 1000 rows x 10 cols, and space for 40 rows on each page, > and specify no widths to help us, then we have to size every > table cell - that's 10,000 objects. We then work out the optimal > column widths for the present page. We then say "OK, I can > only fit about 40 rows on this page", and we split it into a 40- > row table and a 960-row table. > > Then, on the next page, we start again, this time sizing 9600 > cells. But this page might have a different frame width, so we > just dumbly start again and recalculate all those table cell sizes. I see. Is there a reason to continue sizing cells in vain after reaching a frame split? > AFAIR the LongTable optimisation works by just looking at > the first few rows to work out the column widths. That seems to me the right thing to do, ideally until the first split occurs. > Smarter implementations are certainly possible but I would > urge people to just create a bunch of smaller tables in the > first place. If you are outputting thousands of rows, you > probably have some kind of grouping mechanism or want > headers and footers anyway, and it's easiest to style things > AND faster to render if you use a separate table for each visually > similar slab of content. Agreed, and I do use repeating a header (repeating footers do not exist, if I'm not mistaken). But grouping sometimes is just not an option. Concatenated tables, as I described before, might be a work- around, but then one would need to draw a header (if you need one) only after a split, but not at the beginning of the table, which is also not possible. Dinu From andy at reportlab.com Thu Feb 26 16:04:58 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 26 Feb 2009 21:04:58 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> <956003ae0902260846r383a076bl13278d70cc2de72e@mail.gmail.com> Message-ID: <956003ae0902261304g7101d870t1f4db00543bb469e@mail.gmail.com> 2009/2/26 Dinu Gherman : > Andy Robinson: > > I see. Is there a reason to continue sizing cells in vain after > reaching a frame split? I just reviewed the code and that's exactly what the longTable option does. In my opinion this should be 'on' by default (in fact should have been years ago). Can anyone here see problems if we change this for the next release? A better layout algorithm is possible, but would take a week's work by someone to do it safely, and it's not an internal priority for us right now. Patches are welcome though ;-) - Andy From andy at reportlab.com Thu Feb 26 16:11:02 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 26 Feb 2009 21:11:02 +0000 Subject: [reportlab-users] Tons of table questions In-Reply-To: References: <77A9E75DA75C564D82BDC4B18A7D8525305765@ROHRPOSTIX.tup.ads> <956003ae0902260846r383a076bl13278d70cc2de72e@mail.gmail.com> Message-ID: <956003ae0902261311v612c0c49qfaa34202e2ead8a1@mail.gmail.com> 2009/2/26 Dinu Gherman : > Concatenated tables, as I described before, might be a work- > around, but then one would need to draw a header (if you need > one) only after a split, but not at the beginning of the table, > which is also not possible. That's exactly what the "PTO" mechanism is intended for. But it's way more flexible than simply repeating a row - you can specify tables, other paragraphs or any other chunk of content to be injected at the top or bottom of a page. See test_025_pto on this page...the PDF and RML show this, and the flowables work as you would expect from looking at the RML... http://developer.reportlab.com/examples.html -- Andy From haraldarminmassa at gmail.com Fri Feb 27 06:10:41 2009 From: haraldarminmassa at gmail.com (Harald Armin Massa[legacy]) Date: Fri, 27 Feb 2009 12:10:41 +0100 Subject: [reportlab-users] WordCount in reportlab paragraph Message-ID: Hello, I am creating long insurance documents with reportlab. I use a 2-column-layout on DIN-A4, so the lines are rather shortish (<9cm) And, as it is Liability Insurance AND German language, it is rather layers talk with VERY long words. To add insult, those are expected to be justified. Many times it works. BUT ... then I had lines with only 4 words in them. 'Abgrenzungen und Erweiterungen des' and they "crossed the border", that is: they were drawn outside the Column. Tracking it down, I guessed the culprit withing: _justifyDrawParaLineX ofparagraph.py def _justifyDrawParaLineX( tx, offset, line, last=0): setXPos(tx,offset) extraSpace = line.extraSpace #~ nSpaces = line.wordCount - 1 nSpaces = line.wordCount # This is my fix if last or not nSpaces or abs(extraSpace)<=1e-8 or line.lineBreak: _putFragLine(offset, tx, line) #no space modification else: #~ print "-"*20 #~ print "wordspace",line.extraSpace,nSpaces ,extraSpace / float(nSpaces) #~ print "'"*20 #~ print line tx.setWordSpace(extraSpace / float(nSpaces)) _putFragLine(offset, tx, line) tx.setWordSpace(0) setXPos(tx,-offset) which gave me the following debug output: FragLine('lineBreak' False [yadda yadda yadda] 'text' 'Abgrenzungen und Erweiterungen des' [yadda yadda yadda] 'extraSpace' 76.078425196850333 'wordCount' 3 ) #FragLine As of documentation within the code: class FragLine(ABag): """ class FragLine contains a styled line (ie a line with more than one style):: extraSpace unused space for justification only * wordCount 1+spaces in line for justification purposes* """ Now I was curious: 'Abgrenzungen und Erweiterungen des' are clearly FOUR words, and 3 Spaces. So 1+3 should be 4; and wordCount 3 (as there is no such concept as a "negative word" which could be further down the FragLine) Checking out some more FragLines, I discovered that wordCount allways was "one less then counted by Harald" So I removed that "-1" from _justifyDrawParaLineX and everything works great. (or better, acceptable, as "4 words justified in a line" allways look cruel) My fix works; and using Hennings Wordaxe, splitting those words in Fragmens it even looks fair. BUT: is my fix correct? If yes, can it please be incorporated in RL 2.4 and SVN Trunk? best wishes, HArald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Stra?e 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - EuroPython 2009 will take place in Birmingham - Stay tuned! -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Fri Feb 27 06:53:51 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 27 Feb 2009 11:53:51 +0000 Subject: [reportlab-users] WordCount in reportlab paragraph In-Reply-To: References: Message-ID: <49A7D44F.2090109@chamonix.reportlab.co.uk> Harald Armin Massa[legacy] wrote: > Hello, > > I am creating long insurance documents with reportlab. I use a > 2-column-layout on DIN-A4, so the lines are rather shortish (<9cm) > > And, as it is Liability Insurance AND German language, it is rather layers > talk with VERY long words. > > To add insult, those are expected to be justified. Many times it works. BUT > ... then I had lines with only 4 words in them. > > 'Abgrenzungen und Erweiterungen des' > > and they "crossed the border", that is: they were drawn outside the Column. > > > Tracking it down, I guessed the culprit withing: _justifyDrawParaLineX > ofparagraph.py > > def _justifyDrawParaLineX( tx, offset, line, last=0): > setXPos(tx,offset) > extraSpace = line.extraSpace > #~ nSpaces = line.wordCount - 1 > nSpaces = line.wordCount # This is my fix ........- Harald, thanks for the report. Unfortunately I think the problem lies elsewhere ....... When I run this script from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate, Indenter, SimpleDocTemplate doc = SimpleDocTemplate('test_platypus_just.pdf') doc.rightMargin=3*72 styleSheet = getSampleStyleSheet() bt = styleSheet['BodyText'] btj = ParagraphStyle('bodyText1j',parent=bt,alignment=TA_JUSTIFY) story=[Paragraph("""Subsequent pages test pageBreakBefore, frameBreakBefore and keepTogether attributes. Generated at 1111. The number in brackets at the end of each paragraph is its position in the story. llllllllllllllllllllllllll bbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccc ddddddddddddddddddddd eeee""",btj)] doc.build(story) I see this output if I put a print line.wordCount in _justifyDrawParaLineX C:\Tmp>tparajust.py 5 10 12 2 2 And the split then looks like Subsequent pages test pageBreakBefore, frameBreakBefore and (6) keepTogether attributes. Generated at 1111. The number in brackets at (10) the end of each paragraph is its position in the story. llllllllllllllllllllllllll (12) bbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccc (2) ddddddddddddddddddddd eeee (2) so all the counts are right except the first. I suspect something in the break is improperly incrementing the count (or not decrementing it). I'll take a look today. -- Robin Becker From andy at reportlab.com Fri Feb 27 08:29:24 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 27 Feb 2009 13:29:24 +0000 Subject: [reportlab-users] WordCount in reportlab paragraph In-Reply-To: <49A7D44F.2090109@chamonix.reportlab.co.uk> References: <49A7D44F.2090109@chamonix.reportlab.co.uk> Message-ID: <956003ae0902270529o5f901c8ao723d7a41862440e7@mail.gmail.com> 2009/2/27 Robin Becker : > Harald, thanks for the report. Unfortunately I think the problem lies > elsewhere ... This kind of problem is eminently suited to unit tests, when you have them. Harald, could you spare us a paragraph of super-long German insurance words for a test case without violating client confidentiality? It would be more fun! - Andy From gherman at darwin.in-berlin.de Fri Feb 27 10:17:44 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 27 Feb 2009 16:17:44 +0100 Subject: [reportlab-users] Chart axes without lines? Message-ID: Hi, I'm trying to create more Tufte[1]-like charts, i.e. I'd like to use axes showing labels, but no ticks and especially no axis line. I'm finding it impossible to switch only the axis line off, but leave the labels. Is that right? Regards, Dinu [1] http://en.wikipedia.org/wiki/Edward_Tufte From robin at reportlab.com Fri Feb 27 10:22:59 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 27 Feb 2009 15:22:59 +0000 Subject: [reportlab-users] WordCount in reportlab paragraph In-Reply-To: <956003ae0902270529o5f901c8ao723d7a41862440e7@mail.gmail.com> References: <49A7D44F.2090109@chamonix.reportlab.co.uk> <956003ae0902270529o5f901c8ao723d7a41862440e7@mail.gmail.com> Message-ID: <49A80553.3030905@chamonix.reportlab.co.uk> Andy Robinson wrote: > 2009/2/27 Robin Becker : >> Harald, thanks for the report. Unfortunately I think the problem lies >> elsewhere > ... Harald, I think the(at least my) problem can be fixed with this patch; can you try it out? Index: /code/reportlab/platypus/paragraph.py =================================================================== --- /code/reportlab/platypus/paragraph.py (revision 3441) +++ /code/reportlab/platypus/paragraph.py (working copy) @@ -1118,9 +1118,11 @@ if nText!='' and nText[0]!=' ': g.text += ' ' + nText + ni = 0 for i in w[2:]: g = i[0].clone() g.text=i[1] + if g.text: ni = 1 words.append(g) fontSize = g.fontSize if calcBounds: @@ -1134,6 +1136,7 @@ maxSize = max(maxSize,fontSize) maxAscent = max(maxAscent,ascent) minDescent = min(minDescent,descent) + if not nText and ni: n+=1 currentWidth = newWidth else: #either it won't fit, or it's a lineBreak tag > > This kind of problem is eminently suited to unit tests, when when the unit test framework can look at our pdfs and see that a word is not properly aligned then I'll give in. We could try saving images of these problems (say using ghost script) and then compare images. > you have them. Harald, could you spare us a paragraph > of super-long German insurance words for a test case without > violating client confidentiality? It would be more fun! > > - Andy > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Robin Becker From robin at reportlab.com Fri Feb 27 10:25:57 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 27 Feb 2009 15:25:57 +0000 Subject: [reportlab-users] Chart axes without lines? In-Reply-To: References: Message-ID: <49A80605.4040606@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Hi, > > I'm trying to create more Tufte[1]-like charts, i.e. I'd like > to use axes showing labels, but no ticks and especially no > axis line. I'm finding it impossible to switch only the axis > line off, but leave the labels. Is that right? > > Regards, > > Dinu > > [1] http://en.wikipedia.org/wiki/Edward_Tufte I think visibleAxis = 0 on the particular axis might be what you seek. -- Robin Becker From gherman at darwin.in-berlin.de Fri Feb 27 10:36:35 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 27 Feb 2009 16:36:35 +0100 Subject: [reportlab-users] Chart axes without lines? In-Reply-To: <49A80605.4040606@chamonix.reportlab.co.uk> References: <49A80605.4040606@chamonix.reportlab.co.uk> Message-ID: Robin Becker: > I think visibleAxis = 0 on the particular axis might be what you seek. Oops, indeed! Had not seen that (in the sea of attributes). Thanks, Dinu From andy at reportlab.com Fri Feb 27 10:37:43 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 27 Feb 2009 15:37:43 +0000 Subject: [reportlab-users] WordCount in reportlab paragraph In-Reply-To: <49A80553.3030905@chamonix.reportlab.co.uk> References: <49A7D44F.2090109@chamonix.reportlab.co.uk> <956003ae0902270529o5f901c8ao723d7a41862440e7@mail.gmail.com> <49A80553.3030905@chamonix.reportlab.co.uk> Message-ID: <956003ae0902270737k666b18dcga266b5ea22b22e20@mail.gmail.com> 2009/2/27 Robin Becker : >> This kind of problem is eminently suited to unit tests, when > > when the unit test framework can look at our pdfs and see that a word is not > properly aligned then I'll give in. We could try saving images of these > problems (say using ghost script) and then compare images. Surely we can assume a built-in font (Courier, always 0.6em wide), construct a paragraph, call wrap(), and then assert that certain text appears in line 1, line 2 and so on, and that the amount of extra space on each line is 'as expected'? - Andy From robin at reportlab.com Fri Feb 27 10:56:25 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 27 Feb 2009 15:56:25 +0000 Subject: [reportlab-users] WordCount in reportlab paragraph In-Reply-To: <956003ae0902270737k666b18dcga266b5ea22b22e20@mail.gmail.com> References: <49A7D44F.2090109@chamonix.reportlab.co.uk> <956003ae0902270529o5f901c8ao723d7a41862440e7@mail.gmail.com> <49A80553.3030905@chamonix.reportlab.co.uk> <956003ae0902270737k666b18dcga266b5ea22b22e20@mail.gmail.com> Message-ID: <49A80D29.6030900@chamonix.reportlab.co.uk> Andy Robinson wrote: > 2009/2/27 Robin Becker : >>> This kind of problem is eminently suited to unit tests, when >> when the unit test framework can look at our pdfs and see that a word is not >> properly aligned then I'll give in. We could try saving images of these >> problems (say using ghost script) and then compare images. > > Surely we can assume a built-in font (Courier, always 0.6em wide), > construct a paragraph, call wrap(), and then assert that certain > text appears in line 1, line 2 and so on, and that the amount of > extra space on each line is 'as expected'? > ...... the problem here was not in the breaking, but in some attributes that were collected alongside the break and that then affected the layout. A test could be devised that required the broken paragraph to have a specific structure and then compare all the properties against future outputs. Of course that won't protect against changes in the later layout layer and makes changing the overall algorithm harder since each change requires measuring the properties again etc etc. Perhaps we could just record the expected output of the paragraph rendering rather than converting the pdf to pixels. -- Robin Becker