From ralsina at netmanagers.com.ar Wed Jul 1 18:45:18 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 1 Jul 2009 19:45:18 -0300 Subject: [reportlab-users] SumatraPDF problems? Message-ID: <200907011945.18841.ralsina@netmanagers.com.ar> I just got a report from someone that a PDF I generated using rst2pdf crashes SumtraPDF (http://blog.kowalczyk.info/software/sumatrapdf/index.html) Anyone tried this viewer and knows if its buggy, or what may be happening? I will later try to make some test case that crashes it, as soon as I have a windows box available. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) "Our opponent is an alien starship packed with atomic bombs, I said. We have a protractor. Okay, I?ll go home and see if I can scrounge up a ruler and a piece of string." ? Neal Stephenson From timr at probo.com Wed Jul 1 19:24:02 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 01 Jul 2009 16:24:02 -0700 Subject: [reportlab-users] SumatraPDF problems? In-Reply-To: <200907011945.18841.ralsina@netmanagers.com.ar> References: <200907011945.18841.ralsina@netmanagers.com.ar> Message-ID: <4A4BF012.6080601@probo.com> Roberto Alsina wrote: > I just got a report from someone that a PDF I generated using rst2pdf crashes > SumtraPDF (http://blog.kowalczyk.info/software/sumatrapdf/index.html) > > Anyone tried this viewer and knows if its buggy, or what may be happening? > I run it here because it comes up quicker than Acrobat, and I haven't had troubles. On the other hand, I haven't particularly stressed it... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From tim at reportlab.com Thu Jul 2 04:10:03 2009 From: tim at reportlab.com (Tim Grant) Date: Thu, 02 Jul 2009 09:10:03 +0100 Subject: [reportlab-users] [Fwd: a patch for common.py] Message-ID: <4A4C6B5B.90301@reportlab.com> -------- Original Message -------- Subject: a patch for common.py Date: Thu, 2 Jul 2009 09:03:24 +0900 From: nagashi zundo To: enquiries at reportlab.com Hello I encounterd an error, using reportLab with humanreadable barcode recently. I found a bug in common.py. And made a patch for it, as following. Anyway, Thanks for nice open source software. Index: src/reportlab/graphics/barcode/common.py =================================================================== --- src/reportlab/graphics/barcode/common.py (????? 3513) +++ src/reportlab/graphics/barcode/common.py (?????) @@ -173,7 +173,7 @@ if anchor=='middle': func = 'drawCentredString' elif anchor=='end': func = 'drawRightString' else: func = 'drawString' - getattr(canv,func)(text,x,y) + getattr(canv,func)(x,y,text) canv.restoreState() class MultiWidthBarcode(Barcode): -- ReportLab Europe Ltd. Media House 3 Palmerston Road London SW19 1PG Tel +44-20-8545-1570 From andy at reportlab.com Thu Jul 2 04:14:14 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 2 Jul 2009 09:14:14 +0100 Subject: [reportlab-users] [Fwd: a patch for common.py] Message-ID: <956003ae0907020114o6113bafbs9cb579fde98142a3@mail.gmail.com> This is now fixed in subversion. Thanks! 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 volker.haas at brainbot.com Thu Jul 2 05:23:15 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Thu, 02 Jul 2009 11:23:15 +0200 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <4A44A163.6080807@chamonix.reportlab.co.uk> References: <4A40B189.7090909@brainbot.com> <4A44A163.6080807@chamonix.reportlab.co.uk> Message-ID: <4A4C7C83.2030408@brainbot.com> Robin Becker wrote: > Hi Volker, > > > > > Volker Haas wrote: >> Hi all. >> >> The height of a paragraph flowable is not calculated correctly when >> using xml font tags to change the font size. This only happens if >> *all* of the text in the paragraph flowable is inside a font tag >> which changes the size. >> > > I have attempted to commit a fix for this in the trunk. As I suspected > the problem lies in the difference between the handling in the fast > and slow paragraph paths. To fix this I needed to change the way > autoLeading was behaving in the fast path; that involved getting rid > of the approximation ascent=fontSize descent=0.2*fontSize at least as > far as paragraph positioning is concerned. Thanks for the fix! -- volker haas brainbot technologies ag fon +49 6131 2116394 boppstra?e 64 fax +49 6131 2116392 55118 mainz volker.haas at brainbot.com http://www.brainbot.com/ From johnkeyes at gmail.com Thu Jul 2 07:20:25 2009 From: johnkeyes at gmail.com (John Keyes) Date: Thu, 2 Jul 2009 12:20:25 +0100 Subject: [reportlab-users] [Fwd: a patch for common.py] In-Reply-To: <956003ae0907020114o6113bafbs9cb579fde98142a3@mail.gmail.com> References: <956003ae0907020114o6113bafbs9cb579fde98142a3@mail.gmail.com> Message-ID: <21aa4c930907020420p74055361u5cdc3c28323081f2@mail.gmail.com> I reported this back in May[1], glad to see it's fixed now. Thanks Andy [1] http://two.pairlist.net/pipermail/reportlab-users/2009-May/008314.html On Thu, Jul 2, 2009 at 9:14 AM, Andy Robinson wrote: > This is now fixed in subversion. ?Thanks! > > 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- me: http://www.keyes.ie/ charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie From Michael at Hipp.com Thu Jul 2 15:41:41 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 02 Jul 2009 14:41:41 -0500 Subject: [reportlab-users] Does
not work in Paragraphs? Message-ID: <4A4D0D75.1040402@Hipp.com> def _upper_right(self, canvas, doc): canvas.saveState() letterhead = """ Acme Rocket Shoes, Inc.
31 Dead Coyote Road
Phoenix, AZ 71111
901-333-1234 Fax: 901-333-5678
""" lh = Paragraph(letterhead, self.normal) w,h = lh.wrap(1, 1) # Find required space lh.drawOn(canvas, self.rightEdge-w, self.topEdge-h) canvas.restoreState() The above code just wraps the lines of the address as if the
wasn't there. Am I doing something wrong or is

oken? I'm using 2.3 on WinXP in Py 2.5.4. Thanks, Michael From Michael at Hipp.com Thu Jul 2 16:00:58 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 02 Jul 2009 15:00:58 -0500 Subject: [reportlab-users] Is there a "cell" or "phrase" Flowable? Message-ID: <4A4D11FA.10305@Hipp.com> If I want output that looks like this... Name: Smith, John Street: 300 Boardwalk Place City: Strawberry Hill, KY 71111 Charge: Drunk and disorderly conduct Officer's report: Suspect was found hanging upside down from a lamppost with a dumb look on his face and a barmaid under each arm all the while singing loudly and off key. But I don't know beforehand how long each of those fields are and might want them to all be on one line if they happen to fit. In other words, I want them to flow left-right, then top-bottom with line breaks only as needed. There would be, ideally, 5 Flowables in the above example. All the current Flowables seem to be purely top-bottom oriented (they're all sort-of a paragraph). Could any Flowables be made to work this way? Thanks, Michael From paul.barrass at safeonlinebilling.com Thu Jul 2 16:10:37 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 02 Jul 2009 21:10:37 +0100 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D0D75.1040402@Hipp.com> References: <4A4D0D75.1040402@Hipp.com> Message-ID: <4A4D143D.9020009@safeonlinebilling.com> Michael Hipp wrote: > def _upper_right(self, canvas, doc): > .... > The above code just wraps the lines of the address as if the
> wasn't there. Am I doing something wrong or is

oken? > Have you looked at Preformatted and/or XPreformatted - they might be more suited to what you want? Paul Barrass. From Michael at Hipp.com Thu Jul 2 16:39:09 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 02 Jul 2009 15:39:09 -0500 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D143D.9020009@safeonlinebilling.com> References: <4A4D0D75.1040402@Hipp.com> <4A4D143D.9020009@safeonlinebilling.com> Message-ID: <4A4D1AED.8080205@Hipp.com> Paul Barrass wrote: > Michael Hipp wrote: >> def _upper_right(self, canvas, doc): >> .... > >> The above code just wraps the lines of the address as if the
>> wasn't there. Am I doing something wrong or is

oken? >> > Have you looked at Preformatted and/or XPreformatted - they might be > more suited to what you want? Yes. But note that in the code my string has a largew number of leading spaces as well as extraneous newlines. So this will make it print a lot bigger than it actually is. Thanks, Michael From timr at probo.com Thu Jul 2 16:44:14 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 02 Jul 2009 13:44:14 -0700 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D0D75.1040402@Hipp.com> References: <4A4D0D75.1040402@Hipp.com> Message-ID: <4A4D1C1E.7030807@probo.com> Michael Hipp wrote: > ... > The above code just wraps the lines of the address as if the
> wasn't there. Am I doing something wrong or is

oken? Well, it's hard to say that it's "broken". It was never in there to begin with. The Platypus HTML parser only understands , , , , , , , , , , , , , and . The code in paraparser.py. I don't think it would be rocket science to add
, since the thing returns a list of line fragments. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Michael at Hipp.com Thu Jul 2 17:05:17 2009 From: Michael at Hipp.com (Michael Hipp) Date: Thu, 02 Jul 2009 16:05:17 -0500 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D1C1E.7030807@probo.com> References: <4A4D0D75.1040402@Hipp.com> <4A4D1C1E.7030807@probo.com> Message-ID: <4A4D210D.4020806@Hipp.com> Tim Roberts wrote: > Michael Hipp wrote: >> ... >> The above code just wraps the lines of the address as if the
>> wasn't there. Am I doing something wrong or is

oken? > > Well, it's hard to say that it's "broken". It was never in there to > begin with.' Well I didn't know that. Note that reportlab-userguide.pdf says it's in there (section 6.3, page 70). And the
tag is shown (apparently working) in the examples in figures 6-8 and 6-11 (page 71, 72). Thanks, Michael From andy at reportlab.com Thu Jul 2 17:43:12 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 2 Jul 2009 22:43:12 +0100 Subject: [reportlab-users] Is there a "cell" or "phrase" Flowable? In-Reply-To: <4A4D11FA.10305@Hipp.com> References: <4A4D11FA.10305@Hipp.com> Message-ID: <956003ae0907021443l1529f700o3877c49a3a341ab6@mail.gmail.com> 2009/7/2 Michael Hipp : > Could any Flowables be made to work this way? No, sorry. They really do flow downwards ('display:block' in CSS, which was not well understood when we started out or we'd have nicked their terminology). I think you need to decide whether one fact per line is tolerable - in which case you can use a table, or a paragraph with the 'bullet' feature for "City:" etc, which could let you indent follow-on lines nicely. If you really want to do your own 'line breaking' rules for such a block of facts (which are not obvious to me), your best bet is to write a new flowable using stringWidth internally. This is not hard at all. - Andy From timr at probo.com Thu Jul 2 18:39:47 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 02 Jul 2009 15:39:47 -0700 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D210D.4020806@Hipp.com> References: <4A4D0D75.1040402@Hipp.com> <4A4D1C1E.7030807@probo.com> <4A4D210D.4020806@Hipp.com> Message-ID: <4A4D3733.8080607@probo.com> Michael Hipp wrote: > Tim Roberts wrote: >> Michael Hipp wrote: >>> ... >>> The above code just wraps the lines of the address as if the
>>> wasn't there. Am I doing something wrong or is

oken? >> >> Well, it's hard to say that it's "broken". It was never in there to >> begin with.' > > Well I didn't know that. Note that reportlab-userguide.pdf says it's > in there (section 6.3, page 70). And the
tag is shown > (apparently working) in the examples in figures 6-8 and 6-11 (page 71, > 72). I'm a few versions behind (2.0), so it's possible it was added later. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From mjf at pearson.co.uk Fri Jul 3 05:21:48 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Fri, 03 Jul 2009 10:21:48 +0100 Subject: [reportlab-users] Does
not work in Paragraphs? In-Reply-To: <4A4D0D75.1040402@Hipp.com> References: <4A4D0D75.1040402@Hipp.com> Message-ID: <4A4DCDAC.50302@pearson.co.uk> Michael Hipp wrote: > lh = Paragraph(letterhead, self.normal) > w,h = lh.wrap(1, 1) # Find required space > lh.drawOn(canvas, self.rightEdge-w, self.topEdge-h) > > The above code just wraps the lines of the address as if the
> wasn't there. Am I doing something wrong or is

oken? The call to wrap() is telling the Paragraph: fit yourself as best you can in a space 1 point wide. So I'd expect it to break at every word. The
tells it to break there, which it does. It doesn't tell it not to break anywhere else. If you pass a larger width to wrap(), the line breaking will behave as you want (as long as none of the lines is even longer). But the width returned by wrap() will be the same as the width passed to it, so that won't help you get the letterhead right-aligned. If you really want to use a Flowable, I think you'd need to strip out the whitespace yourself and use one of the Preformatted classes, but personally I'd just do it with a bunch of canvas.drawRightString calls. Matt Folwell From icottee at bluefountain.com Fri Jul 3 06:01:02 2009 From: icottee at bluefountain.com (Ian Cottee) Date: Fri, 3 Jul 2009 11:01:02 +0100 Subject: [reportlab-users] Code 39 Check digit bug ? Message-ID: <50a6dc0c0907030301o725434a2rfcc25e070478a959@mail.gmail.com> Using reportlab2.2, with python2.5 on Mac OSX from reportlab.graphics.barcode import code39 In [2]: bc1 = code39.Extended39('48281450412') In [4]: bc1.validate() Out[4]: '48281450412' In [5]: bc1.encode() Out[5]: '*48281450412**' That check digit of '*' appears to be wrong. Our clients can't scan the code and the docs would appear to say that it should be a '$'. Using the code from Wikipedia at http://en.wikipedia.org/wiki/Code_39 def append_c39_checksum(st): charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" return st + charset[ sum(charset.index(c) for c in st) % 43 ] In [8]: append_c39_checksum('48281450412') Out[8]: '48281450412$' Is this a known issue or a misunderstanding on my part? It only appears to happen when the checkdigit sum is 39. We have the same result on the clients system which is running Ubuntu 8.04 Many thanks Ian Cottee Blue Fountain Systems Ltd From andy at reportlab.com Fri Jul 3 06:07:40 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 3 Jul 2009 11:07:40 +0100 Subject: [reportlab-users] Code 39 Check digit bug ? In-Reply-To: <50a6dc0c0907030301o725434a2rfcc25e070478a959@mail.gmail.com> References: <50a6dc0c0907030301o725434a2rfcc25e070478a959@mail.gmail.com> Message-ID: <956003ae0907030307g77d4e98ej56fe46abe8736573@mail.gmail.com> 2009/7/3 Ian Cottee : > Is this a known issue or a misunderstanding on my part? It only > appears to happen when the checkdigit sum is 39. We have the same > result on the clients system which is running Ubuntu 8.04 It is not a known issue, but nobody within ReportLab actually knows about or uses these codes regularly - it was a contribution. If nobody else on the list disagrees, feel free to submit a patch. Sadly I can't allocate anyone at our end to barcode research in the next 2 weeks but we're happy to run patches and run the test output through our scanner. 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 robin at reportlab.com Fri Jul 3 08:43:52 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 03 Jul 2009 13:43:52 +0100 Subject: [reportlab-users] Code 39 Check digit bug ? In-Reply-To: <50a6dc0c0907030301o725434a2rfcc25e070478a959@mail.gmail.com> References: <50a6dc0c0907030301o725434a2rfcc25e070478a959@mail.gmail.com> Message-ID: <4A4DFD08.8080906@chamonix.reportlab.co.uk> Ian Cottee wrote: > Using reportlab2.2, with python2.5 on Mac OSX > > from reportlab.graphics.barcode import code39 > In [2]: bc1 = code39.Extended39('48281450412') > > In [4]: bc1.validate() > Out[4]: '48281450412' > > In [5]: bc1.encode() > Out[5]: '*48281450412**' > > That check digit of '*' appears to be wrong. Our clients can't scan > the code and the docs would appear to say that it should be a '$'. > > Using the code from Wikipedia at > > http://en.wikipedia.org/wiki/Code_39 > I looked at the code39 _patterns and it seems that we have an extra character ie * in between ' ' and '$'. That character is also in the _valchars array there and in the definition of _std_chars. The _patterns are used to calculate the value of the Checking in the original contribution and that is there. So presumably there was some mistake in the original coding. I believe that * is allowed to be transmitted as the start and stop characters (cf http://www.barcodeman.com/info/c39_1.php3) so it has a valid pattern, but obviously there's a bug since we should not include it in the valid character set. I have tried a small patch which is in the attached file. I've checked and we now get the right value from _encode39 ie >>>> code39._encode39('48281450412',1,1) > '*48281450412$*' can interested people try this out? > def append_c39_checksum(st): > charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" > return st + charset[ sum(charset.index(c) for c in st) % 43 ] > > In [8]: append_c39_checksum('48281450412') > Out[8]: '48281450412$' > > Is this a known issue or a misunderstanding on my part? It only > appears to happen when the checkdigit sum is 39. We have the same > result on the clients system which is running Ubuntu 8.04 > > Many thanks > > Ian Cottee > Blue Fountain Systems Ltd >........ -- Robin Becker -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: code39.py Url: From mdriscoll at co.marshall.ia.us Mon Jul 6 13:42:58 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 06 Jul 2009 12:42:58 -0500 Subject: [reportlab-users] Doing multiple pages with variable data Message-ID: <4A5237A2.2080701@co.marshall.ia.us> Hi, I know this is probably a common question, but I'm not finding the answer in the archives so far. I have a large dataset with varied lengths of data. Basically, it will be a list of lists or a list of dicts. Anyway, I don't really know how much will be able to fit per page with my current requirements. What is the recommended way of putting semi-random data onto multiple pages and getting it to break correctly? Do I have to count the number of lines I've output somehow? I am using reportlab 2.3 with Python 2.5.2 on Windows XP. Thanks, Mike From timr at probo.com Mon Jul 6 14:45:23 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 06 Jul 2009 11:45:23 -0700 Subject: [reportlab-users] Doing multiple pages with variable data In-Reply-To: <4A5237A2.2080701@co.marshall.ia.us> References: <4A5237A2.2080701@co.marshall.ia.us> Message-ID: <4A524643.7010108@probo.com> Mike Driscoll wrote: > > I know this is probably a common question, but I'm not finding the > answer in the archives so far. I have a large dataset with varied > lengths of data. Basically, it will be a list of lists or a list of > dicts. Anyway, I don't really know how much will be able to fit per > page with my current requirements. What is the recommended way of > putting semi-random data onto multiple pages and getting it to break > correctly? Do I have to count the number of lines I've output somehow? I guess it depends on how much you need to do to the data. Platypus is really good at managing documents that consist of a series of "flowables". If your data can be arranged in a series of things of variable height that are page-wide, then what you ask is pretty easy. You can just derive your own class from Paragraph and lay things out yourself. If you need spreadsheet-like functionality, where things need to break within cells and cells can be arbitrarily large, that's where things get really tricky. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gherman at darwin.in-berlin.de Mon Jul 6 16:28:57 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 6 Jul 2009 22:28:57 +0200 Subject: [reportlab-users] Geraldo Message-ID: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> Hi, I just stumbled over Geraldo [1], which seems to be something like a replacement for Platypus. Has anybody already made any experience using it? Regards, Dinu [1] http://pypi.python.org/pypi/Geraldo/0.3.2-alpha-4 ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From mdriscoll at co.marshall.ia.us Mon Jul 6 17:10:06 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 06 Jul 2009 16:10:06 -0500 Subject: [reportlab-users] Doing multiple pages with variable data In-Reply-To: <4A524643.7010108@probo.com> References: <4A5237A2.2080701@co.marshall.ia.us> <4A524643.7010108@probo.com> Message-ID: <4A52682E.8040305@co.marshall.ia.us> Hi Tim, > Mike Driscoll wrote: > >> I know this is probably a common question, but I'm not finding the >> answer in the archives so far. I have a large dataset with varied >> lengths of data. Basically, it will be a list of lists or a list of >> dicts. Anyway, I don't really know how much will be able to fit per >> page with my current requirements. What is the recommended way of >> putting semi-random data onto multiple pages and getting it to break >> correctly? Do I have to count the number of lines I've output somehow? >> > > I guess it depends on how much you need to do to the data. Platypus is > really good at managing documents that consist of a series of > "flowables". If your data can be arranged in a series of things of > variable height that are page-wide, then what you ask is pretty easy. > You can just derive your own class from Paragraph and lay things out > yourself. > > If you need spreadsheet-like functionality, where things need to break > within cells and cells can be arbitrarily large, that's where things get > really tricky. > > I noticed that Platypus is supposed to do what I want, but there doesn't seem to be many good examples. I have some annoying requirements due to the fact that the original was based on a Crystal Report. Basically, I have some boxed headers kind of like this (except I need three or more of these columns right next to each other horizontally): ----------------------------------- * Some Heading * * Hours Amount ----------------------------------- ct 24.00 456.84 h # various other lines may follow ----------------------------------- Another Heading 50.56 # various other lines may follow It's a financial document, so I'll need the Amount column to have some underlines at specific junctures to indicate some kind of total. I may be able to use the weird example on Frames in the user guide. It looks like I can create Frames of a certain width and at a certain location on the page, but the docs don't say if I can leave the height to be calculated on the fly. If not, then this won't work either. Anyway, if you or someone else on the list has a suggestion, that would be great. In the meantime, I'll continue trying to grasp how to set this up in my head and by messing with some down and dirty coding. Thanks! - Mike From marinho at gmail.com Mon Jul 6 18:40:37 2009 From: marinho at gmail.com (Marinho Brandao) Date: Mon, 6 Jul 2009 19:40:37 -0300 Subject: [reportlab-users] Geraldo In-Reply-To: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> Message-ID: <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> hi Dinu, no, Geraldo is not a replacement for Platypus Geraldo uses its ParagraphStyle and KeepInFrame functions to make good PDF outputs. but Geraldo is not only that. Geraldo make things like bands, subreports, page header/footer, report begin/end, data driving grids, etc... and output files in PDF (using ReportLab) and Text formats (and in a near future, also to ODF Docs and Sheets). I hope this can help you to clear about their differences :) 2009/7/6 Dinu Gherman : > Hi, > > I just stumbled over Geraldo [1], which seems to be something like > a replacement for Platypus. Has anybody already made any experience > using it? > > Regards, > > Dinu > > [1] http://pypi.python.org/pypi/Geraldo/0.3.2-alpha-4 > > ...................................................................... > Follow me on Twitter: http://twitter.com/dinugherman > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Marinho Brand?o (Jos? M?rio) http://marinhobrandao.com/ From andy at reportlab.com Tue Jul 7 03:39:52 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 7 Jul 2009 08:39:52 +0100 Subject: [reportlab-users] Geraldo In-Reply-To: <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> Message-ID: <956003ae0907070039g58caf397g5967e5a238a0da19@mail.gmail.com> 2009/7/6 Marinho Brandao : > but Geraldo is not only that. Geraldo make things like bands, > subreports, page header/footer, report begin/end, data driving grids, > etc... and output files in PDF (using ReportLab) and Text formats (and > in a near future, also to ODF Docs and Sheets). > This sounds like a neat project - with great screen shots. I look forward to seeing more of it... -- Andy Robinson From kush.iitk+reportlab at gmail.com Tue Jul 7 05:45:51 2009 From: kush.iitk+reportlab at gmail.com (Kush Sharma) Date: Tue, 7 Jul 2009 15:15:51 +0530 Subject: [reportlab-users] Incorrect rendering of Devanagari glyphs by reportlab In-Reply-To: References: Message-ID: Hi, I am trying to develop an application which needs to create PDF files. The data I need to publish contains English as well as Hindi text (Devanagari script). However, reportlab is not able to render the Devanagari glyphs correctly. The code to write a sample devanagari text to PDF is attached alongwith the obtained PDF and expected/correct PDF. This code uses the mangal.ttf font available with windows distribution. It would be great if anyone could help resolve this issue. Thanks. With Regards, Kush -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fonttest.py Type: application/octet-stream Size: 515 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: fonttest.pdf Type: application/pdf Size: 8943 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: correct.pdf Type: application/pdf Size: 8995 bytes Desc: not available Url : From marinho at gmail.com Tue Jul 7 06:48:11 2009 From: marinho at gmail.com (Marinho Brandao) Date: Tue, 7 Jul 2009 07:48:11 -0300 Subject: [reportlab-users] Geraldo In-Reply-To: <956003ae0907070039g58caf397g5967e5a238a0da19@mail.gmail.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> <956003ae0907070039g58caf397g5967e5a238a0da19@mail.gmail.com> Message-ID: <5d1dc4bb0907070348n3f06cf39s2972615cd2d10b84@mail.gmail.com> What you have to keep in mind is that: - ReportLab (with Platypus) is just a (great) PDF generator - Geraldo is a report engine, that uses ReportLab to generate PDF but is not boundered inside this. Geraldo competes with ReportBuilder, Crystal Reports, Jasper, etc... but not competes with ReportLab. There are totally different goals. I use Geraldo in an ERP, to print out purchase forms, to print bank bills, to print lists of customers, supliers, products, orders, etc. In other project I use Geraldo to make reports with charts, images and tech details from a laboratory that investigates defects on big electrical transformers (those that companies like Vale and Petrobras use). Most of people use Geraldo like I use :) but whatever, it is a report engine, not a PDF generator :) 2009/7/7 Andy Robinson : > 2009/7/6 Marinho Brandao : >> but Geraldo is not only that. Geraldo make things like bands, >> subreports, page header/footer, report begin/end, data driving grids, >> etc... and output files in PDF (using ReportLab) and Text formats (and >> in a near future, also to ODF Docs and Sheets). >> > > This sounds like a neat project - with great screen shots. ?I look > forward to seeing more of it... > > -- > Andy Robinson > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Marinho Brand?o (Jos? M?rio) http://marinhobrandao.com/ From gherman at darwin.in-berlin.de Wed Jul 8 10:46:06 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 8 Jul 2009 16:46:06 +0200 Subject: [reportlab-users] Geraldo In-Reply-To: <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> Message-ID: <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> Marinho Brandao: > [...] but Geraldo is not only that. Geraldo make things like bands, > subreports, page header/footer, report begin/end, data driving grids, > etc... and output files in PDF (using ReportLab) and Text formats (and > in a near future, also to ODF Docs and Sheets). Hi Marinho, thanks for the explanation! Maybe I'm mistaken, but it seems to me like your implicit definition of the term "report" is that of a rectangular area (mostly table-like) with data-like "stuff" inside. That would make sense given how you use the term "subreport". I think I'm probably wrong, at least to some degree, but I'd much appreciate some clarification of the terms "report/subreport" as well as "band" and "grid" in this context. BTW, I've seen recently a presentation on JasperReports and was im- pressed with their interactive tools. Pitty, RL hasn't developped into that area, at least not with public tools, AFAIK. Regards, Dinu PS: It would be nice to see some really running testsuite instead of the ASCII text in the distribution. Python's unittest package is great for doing this... ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From marinho at gmail.com Wed Jul 8 11:07:06 2009 From: marinho at gmail.com (Marinho Brandao) Date: Wed, 8 Jul 2009 12:07:06 -0300 Subject: [reportlab-users] Geraldo In-Reply-To: <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> Message-ID: <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> Hi Dinu, yes, "report" is an expression that can have many meanings. ReportLab uses the word "report" meaning "write things on a blank page, as a canvas". but in ERPs, CRMs and others corporate softwares, "report" means "data output, with header, footer, summary, etc.". This topic is for softwares like Jasper, Crystal Reports, ReportBuilder, QuickReport, FastReport, ZReport, etc. and Geraldo is a new one on this market. about Report x SubReport, you have to think that a "Report" is the main one, driven by a detail band, that is rendered from a list of objects from the attribute "queryset". SubReport is a child list. If you are printing a Purchase form, you have a Report, but a Purchase has Bills and Products... then you can have 2 SubReports: a list of Bills and a list of Products. In other hand, you can need a way to group data by some fields. Then you have ReportGroup. Example: if you are printing a list of Customers, maybe you want to group them by their types (i.e.: Good Customer, Ordinary Customer, Bad Customer, etc) Do you follow me? A band is not an easy thing to explain to who is not used to use report engines... but you can understand a band as a row in the report with a defined job. Example: the Page Header Band is a row with widgets an graphic elements that will be printed on the top of all pages (to print the report title, page number, etc.).... the Page Footer is exactly the same, but will be printed on the page footer... the Detail Band is the main one, because it is printed for each object in the list (the attribute "queryset"), etc... Geraldo has other features, aggregation fields (i.e.: to sum up a field value or to count the total of objects in a list, etc), system fields (i.e. printing date/time, page number, page count, etc.) please check the docs for more details: http://geraldo.sourceforge.net/ :) 2009/7/8 Dinu Gherman : > Marinho Brandao: > >> [...] but Geraldo is not only that. Geraldo make things like bands, >> subreports, page header/footer, report begin/end, data driving grids, >> etc... and output files in PDF (using ReportLab) and Text formats (and >> in a near future, also to ODF Docs and Sheets). > > > Hi Marinho, > > thanks for the explanation! Maybe I'm mistaken, but it seems to me > like your implicit definition of the term "report" is that of a > rectangular area (mostly table-like) with data-like "stuff" inside. > That would make sense given how you use the term "subreport". I > think I'm probably wrong, at least to some degree, but I'd much > appreciate some clarification of the terms "report/subreport" as > well as "band" and "grid" in this context. > > BTW, I've seen recently a presentation on JasperReports and was im- > pressed with their interactive tools. Pitty, RL hasn't developped > into that area, at least not with public tools, AFAIK. > > Regards, > > Dinu > > PS: It would be nice to see some really running testsuite instead > of the ASCII text in the distribution. Python's unittest package > is great for doing this... > > ...................................................................... > Follow me on Twitter: http://twitter.com/dinugherman > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Marinho Brand?o (Jos? M?rio) http://marinhobrandao.com/ From andy at reportlab.com Wed Jul 8 11:14:57 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 8 Jul 2009 16:14:57 +0100 Subject: [reportlab-users] Geraldo In-Reply-To: <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> Message-ID: <956003ae0907080814u4f43666el2e308f56f2617ba9@mail.gmail.com> 2009/7/8 Marinho Brandao : > Hi Dinu, > > yes, "report" is an expression that can have many meanings. > > ReportLab uses the word "report" meaning "write things on a blank > page, as a canvas". Actually, when we stated the company, we thought we would be doing your kind of banded reports. Then it became more like "personalised publishing" and we often feel ReportLab was the wrong name ;-) - Andy From Michael at Hipp.com Wed Jul 8 11:25:40 2009 From: Michael at Hipp.com (Michael Hipp) Date: Wed, 08 Jul 2009 10:25:40 -0500 Subject: [reportlab-users] Geraldo In-Reply-To: <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> Message-ID: <4A54BA74.4070004@Hipp.com> Thanks for the explanations, Marinho. I was in process of writing an abstraction layer on top of ReportLab in similar fashion to Geraldo. Yours looks well done and is much farther along. I'm giving it a whirl. Thanks, Michael Marinho Brandao wrote: > Hi Dinu, > > yes, "report" is an expression that can have many meanings. > > ReportLab uses the word "report" meaning "write things on a blank > page, as a canvas". From marinho at gmail.com Wed Jul 8 11:35:40 2009 From: marinho at gmail.com (Marinho Brandao) Date: Wed, 8 Jul 2009 12:35:40 -0300 Subject: [reportlab-users] Geraldo In-Reply-To: <4A54BA74.4070004@Hipp.com> References: <198F8859-A247-4415-B05B-D04C6D6DEDEB@darwin.in-berlin.de> <5d1dc4bb0907061540v1c827169y2bbd5787668120c9@mail.gmail.com> <66E522DD-0044-4FE4-ADE2-9B8F6D5D5A23@darwin.in-berlin.de> <5d1dc4bb0907080807q3d1bc7d6w4663440e1d305cba@mail.gmail.com> <4A54BA74.4070004@Hipp.com> Message-ID: <5d1dc4bb0907080835x51407610x535f8225af738ea1@mail.gmail.com> Hi, well, I'm happy you like Geraldo :) I have big plans on its project... currently I'm working on the Text generator and on a basic version of a visual editor. I started also the coding to generator ODF Docs and Sheets and would like to write a Reports Server (so, Geraldo will useful for other languages, using a webservice to communicate). All help are welcome, including also write documentation and tutorials, correcting my gramatical and spelling mistakes, etc... best regards, 2009/7/8 Michael Hipp : > Thanks for the explanations, Marinho. I was in process of writing an > abstraction layer on top of ReportLab in similar fashion to Geraldo. Yours > looks well done and is much farther along. I'm giving it a whirl. > > Thanks, > Michael > > > Marinho Brandao wrote: >> >> Hi Dinu, >> >> yes, "report" is an expression that can have many meanings. >> >> ReportLab uses the word "report" meaning "write things on a blank >> page, as a canvas". > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Marinho Brand?o (Jos? M?rio) http://marinhobrandao.com/ From robertrobert93 at yahoo.com Wed Jul 8 13:58:17 2009 From: robertrobert93 at yahoo.com (Robert Robert) Date: Wed, 8 Jul 2009 10:58:17 -0700 (PDT) Subject: [reportlab-users] memory error Message-ID: <380772.66752.qm@web59303.mail.re1.yahoo.com> Hello All, I am creating a pdf file in which I include images. A lot of them. When I open the python script with IDLE, the first time it works perfectly. When I want to recreate the PDF file I get a memory error as follow; In string.py" return sep.join(words) MemoryError Does anyone knows how to solve this problem ? Thanks in advance, robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at shellike.com Wed Jul 8 14:36:05 2009 From: tim at shellike.com (Tim Greening-Jackson) Date: Wed, 8 Jul 2009 19:36:05 +0100 Subject: [reportlab-users] Any advice installing Reportlab 2.3 under Python 2.6 on Ubuntu 9.04? Message-ID: <407d29cd0907081136q7f7affe0kdd782522c30b786e@mail.gmail.com> Hi there. I am attempting to install Reportlab 2.3 under Ubuntu 9.04 (2.6.28-13-generic kernel) running Python 2.6.2 When I run the pre-install tests I get the following: tim at poirot:~/ReportLab_2_3$ python setup.py tests-preinstall .................................................................................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 "/home/tim/ReportLab_2_3/tools/docco/yaml2pdf.py", line 54, in run story.append(Paragraph(text, style, bulletText=bulletText)) File "/home/tim/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 798, in __init__ self._setup(text, style, bulletText, frags, cleanBlockQuotedText) File "/home/tim/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 "/home/tim/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 65.924s FAILED (failures=1) I've installed python2.6-dev and Freetype 2.3.9 Any tips on what I'm doing wrong? I'm sure it must be elementary. Cheers. Tim From andy at reportlab.com Wed Jul 8 15:18:54 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 8 Jul 2009 20:18:54 +0100 Subject: [reportlab-users] memory error In-Reply-To: <380772.66752.qm@web59303.mail.re1.yahoo.com> References: <380772.66752.qm@web59303.mail.re1.yahoo.com> Message-ID: <956003ae0907081218sd0d7d62n5313ccf6b9ec4ef1@mail.gmail.com> 2009/7/8 Robert Robert : > Hello All, > I am creating a pdf file in which I include images. A lot of them. When I > open the python script with IDLE, the first time it works perfectly. When I > want to recreate the PDF file I get a memory error as follow; > > In string.py" > return sep.join(words) > MemoryError We construct the PDF file in memory. At a certain point, you run out. We could optimize for specific cases but then somebody would just decide to put 1000 5Mb images in a PDF where previously they did 500, and the same would happen elsewhere in the code. As a very, very rough rule of thumb, we tend to need 10Mb of RAM for 1Mb of PDF output, because there are lots of streams that get compressed to make the final PDF file. As another rule of thumb, if you're using jpegs (which just get inlined in the PDF) then the total PDF size is the size of all the images, plus 5-10% more for enclosing them. So, add up the size of images you need to include, decide if it's reasonable for your system (and if anybody really wants a 100M PDF file), and then either make several smaller documents, or use something like PIL to shrink your images to a more appropriate resolution. I hope this helps but I doubt it will ;-) -- 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 Jul 8 15:34:58 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 8 Jul 2009 20:34:58 +0100 Subject: [reportlab-users] Any advice installing Reportlab 2.3 under Python 2.6 on Ubuntu 9.04? In-Reply-To: <407d29cd0907081136q7f7affe0kdd782522c30b786e@mail.gmail.com> References: <407d29cd0907081136q7f7affe0kdd782522c30b786e@mail.gmail.com> Message-ID: <956003ae0907081234j47ea1926k7f65dc1956536a60@mail.gmail.com> 2009/7/8 Tim Greening-Jackson : > Hi there. I am attempting to install Reportlab 2.3 under Ubuntu 9.04 > (2.6.28-13-generic kernel) running Python 2.6.2 > > When I run the pre-install tests I get the following: > > tim at poirot:~/ReportLab_2_3$ python setup.py tests-preinstall > .................................................................................Traceback > Any tips on what I'm doing wrong? I'm sure it must be elementary. It's a known issue with 2.3 and can be safely ignored. If you go ahead and install, then run the tests after installing, they should be clean. The reason is that one test fails because a C extension is not yet compiled. This is fixed in subversion and the daily builds. 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 mdriscoll at co.marshall.ia.us Wed Jul 8 15:58:13 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 08 Jul 2009 14:58:13 -0500 Subject: [reportlab-users] Aligning tablle example Message-ID: <4A54FA55.8010505@co.marshall.ia.us> Hi, I am trying to figure out how to left or right align an entire table. However, the docs only talk about aligning the cells within a table. Can someone tell me how to do this, preferably with some kind of example? Thanks, Mike From tim at shellike.com Wed Jul 8 16:30:06 2009 From: tim at shellike.com (Tim Greening-Jackson) Date: Wed, 8 Jul 2009 21:30:06 +0100 Subject: [reportlab-users] Any advice installing Reportlab 2.3 under Python 2.6 on Ubuntu 9.04? In-Reply-To: <956003ae0907081234j47ea1926k7f65dc1956536a60@mail.gmail.com> References: <407d29cd0907081136q7f7affe0kdd782522c30b786e@mail.gmail.com> <956003ae0907081234j47ea1926k7f65dc1956536a60@mail.gmail.com> Message-ID: <407d29cd0907081330j2d81dc4fn81779e2a34da5deb@mail.gmail.com> Hey Andy Many thanks for the prompt reply - it's passed its post-installation tests fine. Wimbledon eh? It's a small world - I used to live in Stockwell until recently. Thanks once more for your help. Best regards. T 2009/7/8 Andy Robinson : > 2009/7/8 Tim Greening-Jackson : >> Hi there. I am attempting to install Reportlab 2.3 under Ubuntu 9.04 >> (2.6.28-13-generic kernel) running Python 2.6.2 >> >> When I run the pre-install tests I get the following: >> >> tim at poirot:~/ReportLab_2_3$ python setup.py tests-preinstall >> .................................................................................Traceback >> Any tips on what I'm doing wrong? I'm sure it must be elementary. > > It's a known issue with 2.3 and can be safely ignored. ?If you go > ahead and install, then run the tests after installing, they should be > clean. > > The reason is that one test fails because a C extension is not yet > compiled. ? ?This is fixed in subversion and the daily builds. > > > 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From andy at reportlab.com Wed Jul 8 16:34:56 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 8 Jul 2009 21:34:56 +0100 Subject: [reportlab-users] Aligning tablle example In-Reply-To: <4A54FA55.8010505@co.marshall.ia.us> References: <4A54FA55.8010505@co.marshall.ia.us> Message-ID: <956003ae0907081334m525eb1e1g51f3f50cd7ac8fe5@mail.gmail.com> 2009/7/8 Mike Driscoll : > I am trying to figure out how to left or right align an entire table. > However, the docs only talk about aligning the cells within a table. Can > someone tell me how to do this, preferably with some kind of example? Tables have a property 'hAlign', in common with many other flowables. Sorry it wasn't documented - inside ReportLab we use the RML layer on top so tend not to notice. There is one example in the test suite, test_platypus_pleaseturnover.py - Andy From mdriscoll at co.marshall.ia.us Wed Jul 8 16:42:15 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 08 Jul 2009 15:42:15 -0500 Subject: [reportlab-users] Aligning tablle example In-Reply-To: <956003ae0907081334m525eb1e1g51f3f50cd7ac8fe5@mail.gmail.com> References: <4A54FA55.8010505@co.marshall.ia.us> <956003ae0907081334m525eb1e1g51f3f50cd7ac8fe5@mail.gmail.com> Message-ID: <4A5504A7.3070904@co.marshall.ia.us> Andy Robinson wrote: > 2009/7/8 Mike Driscoll : > >> I am trying to figure out how to left or right align an entire table. >> However, the docs only talk about aligning the cells within a table. Can >> someone tell me how to do this, preferably with some kind of example? >> > > Tables have a property 'hAlign', in common with many other flowables. > Sorry it wasn't documented - inside ReportLab we use the RML layer on > top so tend not to notice. > > There is one example in the test suite, test_platypus_pleaseturnover.py > > - Andy I tried that, using the following code: story = [] doc = SimpleDocTemplate('myDoc.pdf', pagesize=(8.5*inch, 11*inch)) data = [['', 'Hours', 'Amount'], ['ct', '24.00', '456.84'], ['h', '16.00', '310.56'], ['r', '32.00', '621.12'], ['v', '8.00', '155.28']] tbl = Table(data, hAlign=TA_LEFT) story.append(tbl) doc.build(story) This creates an pdf with the table centered. I take it that there's a different way to enable this? - Mike From paul.barrass at safeonlinebilling.com Wed Jul 8 16:45:30 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Wed, 08 Jul 2009 21:45:30 +0100 Subject: [reportlab-users] Aligning tablle example In-Reply-To: <4A5504A7.3070904@co.marshall.ia.us> References: <4A54FA55.8010505@co.marshall.ia.us> <956003ae0907081334m525eb1e1g51f3f50cd7ac8fe5@mail.gmail.com> <4A5504A7.3070904@co.marshall.ia.us> Message-ID: <4A55056A.9030709@safeonlinebilling.com> Mike Driscoll wrote: > Andy Robinson wrote: >> 2009/7/8 Mike Driscoll : >> >> Tables have a property 'hAlign', in common with many other flowables. >> Sorry it wasn't documented - inside ReportLab we use the RML layer on >> top so tend not to notice. >> You seem to be working late tonight Andy? Let me answer this - take a break ;) > tbl = Table(data, hAlign=TA_LEFT) > > story.append(tbl) > doc.build(story) > > > > This creates an pdf with the table centered. I take it that there's a > different way to enable this? > try tbl.hAlign='LEFT' or see: http://two.pairlist.net/pipermail/reportlab-users/2008-November/007679.html where this has been answered before (also by me..) Paul Barrass. From paul.barrass at safeonlinebilling.com Wed Jul 8 16:56:42 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Wed, 08 Jul 2009 21:56:42 +0100 Subject: [reportlab-users] memory error In-Reply-To: <956003ae0907081218sd0d7d62n5313ccf6b9ec4ef1@mail.gmail.com> References: <380772.66752.qm@web59303.mail.re1.yahoo.com> <956003ae0907081218sd0d7d62n5313ccf6b9ec4ef1@mail.gmail.com> Message-ID: <4A55080A.7070206@safeonlinebilling.com> Andy Robinson wrote: > 2009/7/8 Robert Robert : > >> Hello All, >> I am creating a pdf file in which I include images. A lot of them. When I >> open the python script with IDLE, the first time it works perfectly. When I >> want to recreate the PDF file I get a memory error as follow; >> >> In string.py" >> return sep.join(words) >> MemoryError >> > > We construct the PDF file in memory. At a certain point, you run out. I think the problem is that the PDF generation fails the /second/ time, so presumably there is enough memory available, and it's not being fully freed between runs. I see a similar problem when generating thousands of PDFs, the memory usage steadily increases, though so far not to the point of memory exhaustion. Is there something we're supposed to do to 'reset' RL between outputting one PDF and starting on the next? [I'm saying that it is RL that's causing the memory usage since it's never become a large enough problem for me to look into it, it could easily be a memory leak elsewhere] Paul Barrass. From mdriscoll at co.marshall.ia.us Thu Jul 9 10:20:09 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 09 Jul 2009 09:20:09 -0500 Subject: [reportlab-users] Aligning tablle example In-Reply-To: <4A55056A.9030709@safeonlinebilling.com> References: <4A54FA55.8010505@co.marshall.ia.us> <956003ae0907081334m525eb1e1g51f3f50cd7ac8fe5@mail.gmail.com> <4A5504A7.3070904@co.marshall.ia.us> <4A55056A.9030709@safeonlinebilling.com> Message-ID: <4A55FC99.1000404@co.marshall.ia.us> Paul Barrass wrote: > Mike Driscoll wrote: >> Andy Robinson wrote: >>> 2009/7/8 Mike Driscoll : >>> >>> Tables have a property 'hAlign', in common with many other flowables. >>> Sorry it wasn't documented - inside ReportLab we use the RML layer on >>> top so tend not to notice. >>> > > You seem to be working late tonight Andy? Let me answer this - take a > break ;) > > >> tbl = Table(data, hAlign=TA_LEFT) >> >> story.append(tbl) >> doc.build(story) >> >> >> >> This creates an pdf with the table centered. I take it that there's a >> different way to enable this? >> > try tbl.hAlign='LEFT' > > or see: > http://two.pairlist.net/pipermail/reportlab-users/2008-November/007679.html > where this has been answered before (also by me..) > > Paul Barrass. I tried to find the answer with Google, but either my keywords were off or it does a lousy job of indexing pairlist.net. Thanks for the info! - Mike From bentson at holmsjoen.com Thu Jul 9 14:44:31 2009 From: bentson at holmsjoen.com (Randolph Bentson) Date: Thu, 9 Jul 2009 11:44:31 -0700 Subject: [reportlab-users] error in code39.py Message-ID: <20090709184431.GA2656@holmsjoen.com> I've found that some code39 barcodes don't have the correct check character. The problem appears to be that the "*" character was being treated just as the normal chars. I believe the following is a proper fix: =================================================================== diff -u -r1.1 code39.py --- code39.py 2009/07/09 18:10:07 1.1 +++ code39.py 2009/07/09 18:24:09 @@ -54,16 +54,16 @@ 'W': ("BSBsbsbsb", 32), 'X': ("bSbsBsbsB", 33), 'Y': ("BSbsBsbsb", 34), 'Z': ("bSBsBsbsb", 35), '-': ("bSbsbsBsB", 36), '.': ("BSbsbsBsb", 37), - ' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", 39), - '$': ("bSbSbSbsb", 40), '/': ("bSbSbsbSb", 41), - '+': ("bSbsbSbSb", 42), '%': ("bsbSbSbSb", 43) + ' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", None), + '$': ("bSbSbSbsb", 39), '/': ("bSbSbsbSb", 40), + '+': ("bSbsbSbSb", 41), '%': ("bsbSbSbSb", 42), } _valchars = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '-', '.', ' ', '*', '$', '/', '+', '%' + 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%' ] _extended = { =================================================================== -- Randolph Bentson bentson at holmsjoen.com From g.costanzi at email.it Fri Jul 10 01:08:01 2009 From: g.costanzi at email.it (g.costanzi at email.it) Date: Fri, 10 Jul 2009 07:08:01 +0200 Subject: [reportlab-users] TableStyle Alternating the background color Message-ID: <4a7d654e433688a7f8ef5fbf7af263ec@94.37.109.82> Hi How can assign ,in run time, a different colour  to the rows of a table when I set the TableStile? I use a recordset extract from SQLite and depending on a value of a record field, I would like to set a different color. My code,rs is the recordset,if the Price value is > 5000 the I would like to change color in red. def makeTableData(rs):        count = 0     fields = ['Product','Warehouse Code','Supplier','Quantity','Price']       for i in rs:         count += i[4]             tax = (float(count*int(cfg.dict_warehouse[4])/100))     rs.insert(0,fields)     rs.insert(len(rs),['','','','Total',count])     rs.insert(len(rs),['','','','Tax',tax])     rs.insert(len(rs),['','','','After Tax',tax+count])         t = Table(rs,               colWidths=(200,50,50,50,50),               hAlign='CENTER',               repeatRows = 1)     t.setStyle(TableStyle([('ALIGN',(0,0),(-1,0),'CENTER'),                            ('ALIGN',(1,1),(-1,-1),'CENTER'),                            ('BOX',(0,0),(-1, 0), 0.5, colors.black),                            ('BACKGROUND',(0,0),(-1,0),colors.lightgrey),                            ('BACKGROUND',(-1,-1),(-1,-1),colors.lightgrey),                            ('FONT', (-1,-1), (-1,-1), 'Times-Bold'),                            ('GRID',(0,0),(-1,-1), 0.2, colors.black),                            ('FONT', (0,0),(-1,0),'Helvetica-Bold', 10),                            ('VALIGN',(0,0),(-1,-1),'MIDDLE')]))     return t Regards. -- Giuseppe Errare è umano, ma per fare veramente casino ci vuole la password di root... -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it: http://www.email.it/f Sponsor: GRATIS: 250 Biglietti da Visita + 1 elegante Porta biglietti metallico! Spese di spedizione escluse. Offerta limitata, fai in fretta! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8956&d=20090710 -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Fri Jul 10 02:25:17 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 10 Jul 2009 08:25:17 +0200 Subject: [reportlab-users] TableStyle Alternating the background color In-Reply-To: <4a7d654e433688a7f8ef5fbf7af263ec@94.37.109.82> References: <4a7d654e433688a7f8ef5fbf7af263ec@94.37.109.82> Message-ID: g.costanzi at email.it: > How can assign ,in run time, a different colour to the rows of a > table when I set the TableStile? > I use a recordset extract from SQLite and depending on a value of a > record field, I would like to set a different color. > My code,rs is the recordset,if the Price value is > 5000 the I would > like > to change color in red. You look at the data and set the style of the appropriate row accordingly, something like this (untested): ... tab_sty = [...] for i, row in enumerate(rs): if row[*some_index*] > 5000: tab_sty.append(("BACKGROUND", (0,i),(-1,i), colors.red)) t.setStyle(TableStyle(tab_sty)) ... Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From g.costanzi at email.it Sat Jul 11 11:28:33 2009 From: g.costanzi at email.it (g.costanzi at email.it) Date: Sat, 11 Jul 2009 17:28:33 +0200 Subject: [reportlab-users] TableStyle Alternating the background color Message-ID: <847bc8b0e4c06dbb5883490d2d1c7bcc@94.37.109.82> Perfect! Thank you very much. -- Giuseppe Errare è umano, ma per fare veramente casino ci vuole la password di root... --------- Original Message -------- Da: "Dinu Gherman" <gherman at darwin.in-berlin.de> To: "Support list for users of Reportlab software" <reportlab-users at reportlab.com> Oggetto: Re: [reportlab-users] TableStyle Alternating the background color Data: 10/07/09 08:25 g.costanzi at email.it: > How can assign ,in run time, a different colour to the rows of a > table when I set the TableStile? > I use a recordset extract from SQLite and depending on a value of a > record field, I would like to set a different color. > My code,rs is the recordset,if the Price value is > 5000 the I would > like > to change color in red. You look at the data and set the style of the appropriate row accordingly, something like this (untested): ... tab_sty = [...] for i, row in enumerate(rs): if row[*some_index*] > 5000: tab_sty.append(("BACKGROUND", (0,i),(-1,i), colors.red)) t.setStyle(TableStyle(tab_sty)) ... Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it: http://www.email.it/f Sponsor: Scegli Riccione Family Hotels per le vacanze con i tuoi bambini! Il meglio dell?offerta per famiglie, il massimo confort,prezzi vantaggiosi. Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=9307&d=20090711 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jason.Brower at kone.com Mon Jul 13 02:18:12 2009 From: Jason.Brower at kone.com (Brower Jason) Date: Mon, 13 Jul 2009 08:18:12 +0200 Subject: [reportlab-users] (no subject) Message-ID: <7BEADC998EA85041A0170E2F5F726D2FAF115D@EUDEXC01.KONENET.COM> Starting out with this Reportlab and it's pretty fun so far... In testing it's capabilities I noticed an issue. I am trying to insert an inline image and it's not working. The first works. But the other image, , does not. Any ideas what I am doing wrong here? Source: --- from reportlab.pdfgen.canvas import Canvas from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.units import cm from reportlab.platypus import Paragraph, Frame from reportlab.lib.pagesizes import landscape, A4 pdf = Canvas("phello.pdf", landscape(pagesize = A4)) styles = getSampleStyleSheet() styleN = styles['Normal'] styleH = styles['Heading1'] story = [] #add some flowables story.append(Paragraph("This is Frame 1",styleH)) story.append(Paragraph("This is a in Normal style. This is a paragraph in Normal style. ", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) pdf.drawImage("template.png", cm*1, cm*1, width=28*cm, height=19*cm) f = Frame(cm*6.5, cm*1, cm*7, cm*7, showBoundary=1) f.addFromList(story,pdf) story.append(Paragraph("This is a Heading",styleH)) story.append(Paragraph(' --image Another in bold style.
', styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) f2 = Frame(cm, cm*10, 6*cm, 9*cm, showBoundary=1) f2.addFromList(story,pdf) pdf.save() --- Any ideas? I have tried absolute path and relative and both so no changes. It sows not space for it. Do I need to declare width and height? Best Regards, Jason Brower -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jason.Brower at kone.com Mon Jul 13 02:19:15 2009 From: Jason.Brower at kone.com (Brower Jason) Date: Mon, 13 Jul 2009 08:19:15 +0200 Subject: [reportlab-users] Inline images not working.. Message-ID: <7BEADC998EA85041A0170E2F5F726D2FAF1160@EUDEXC01.KONENET.COM> Starting out with this Reportlab and it's pretty fun so far... In testing it's capabilities I noticed an issue. I am trying to insert an inline image and it's not working. The first works. But the other image, , does not. Any ideas what I am doing wrong here? Source: --- from reportlab.pdfgen.canvas import Canvas from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.units import cm from reportlab.platypus import Paragraph, Frame from reportlab.lib.pagesizes import landscape, A4 pdf = Canvas("phello.pdf", landscape(pagesize = A4)) styles = getSampleStyleSheet() styleN = styles['Normal'] styleH = styles['Heading1'] story = [] #add some flowables story.append(Paragraph("This is Frame 1",styleH)) story.append(Paragraph("This is a in Normal style. This is a paragraph in Normal style. ", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) pdf.drawImage("template.png", cm*1, cm*1, width=28*cm, height=19*cm) f = Frame(cm*6.5, cm*1, cm*7, cm*7, showBoundary=1) f.addFromList(story,pdf) story.append(Paragraph("This is a Heading",styleH)) story.append(Paragraph(' --image Another in bold style.
', styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) story.append(Paragraph("And look! Another in bold style.", styleN)) f2 = Frame(cm, cm*10, 6*cm, 9*cm, showBoundary=1) f2.addFromList(story,pdf) pdf.save() --- Any ideas? I have tried absolute path and relative and both so no changes. It sows not space for it. Do I need to declare width and height? Best Regards, Jason Brower -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jul 13 13:26:23 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 13 Jul 2009 10:26:23 -0700 Subject: [reportlab-users] Inline images not working.. In-Reply-To: <7BEADC998EA85041A0170E2F5F726D2FAF1160@EUDEXC01.KONENET.COM> References: <7BEADC998EA85041A0170E2F5F726D2FAF1160@EUDEXC01.KONENET.COM> Message-ID: <4A5B6E3F.5040608@probo.com> Brower Jason wrote: > > Starting out with this Reportlab and it?s pretty fun so far? > > In testing it?s capabilities I noticed an issue. > > I am trying to insert an inline image and it?s not working. The first > works. > > But the other image, , does not. > > Any ideas what I am doing wrong here? > What version of ReportLab are you running? Support for the tag is relatively recent. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From Jason.Brower at kone.com Mon Jul 13 23:57:32 2009 From: Jason.Brower at kone.com (Brower Jason) Date: Tue, 14 Jul 2009 05:57:32 +0200 Subject: [reportlab-users] Inline images not working.. In-Reply-To: <4A5B6E3F.5040608@probo.com> Message-ID: <7BEADC998EA85041A0170E2F5F726D2FAF1885@EUDEXC01.KONENET.COM> According to my Ubuntu 9.04 it is... 2.1dfsg-2 Regards, Jason Brower -----Original Message----- From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Tim Roberts Sent: 13/07/2009 20:26 To: Support list for users of Reportlab software Subject: Re: [reportlab-users] Inline images not working.. Brower Jason wrote: > > Starting out with this Reportlab and it's pretty fun so far... > > In testing it's capabilities I noticed an issue. > > I am trying to insert an inline image and it's not working. The first > works. > > But the other image, , does not. > > Any ideas what I am doing wrong here? > What version of ReportLab are you running? Support for the tag is relatively recent. -- 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 From andy at reportlab.com Tue Jul 14 03:13:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 14 Jul 2009 08:13:25 +0100 Subject: [reportlab-users] Inline images not working.. In-Reply-To: <7BEADC998EA85041A0170E2F5F726D2FAF1885@EUDEXC01.KONENET.COM> References: <4A5B6E3F.5040608@probo.com> <7BEADC998EA85041A0170E2F5F726D2FAF1885@EUDEXC01.KONENET.COM> Message-ID: <956003ae0907140013j3d9d9f5bt6b410b48dc7eae65@mail.gmail.com> 2009/7/14 Brower Jason : > According to my Ubuntu 9.04 it is... > 2.1dfsg-2 > Regards, > Jason Brower I have no idea what dfsg-2 means (that's something the Ubuntu packagers mean) but it must be well over a year old. Try 2.3 from www.reportlab.org or our daily builds. - Andy From simone.dalmasso at gmail.com Tue Jul 14 03:35:43 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Tue, 14 Jul 2009 09:35:43 +0200 Subject: [reportlab-users] Spacer too large at page... Message-ID: Hi list, I built an application which prints some pages depending on the user request. The pdf is composed of a number of documents separated by a page break and at the beginning and at the end of each documents some images are inserted. I encounter a problem when I ask for a pdf composed of several documents but always on a specified page. Here is: Exception Type: LayoutError Exception Value: Flowable ... too large on page 6 The page 6 contains always the same document, but asking for it alone it works fine. Here follows a piece of my code: t = Table(data,style = style) t._argW[0] = 8.5 * cm #first column width w,h = t.wrap(A4[0]-2*cm,A4[1]) story.append(header) story.append(space) story.append(t) story.append(space) story.append(footer) story.append(PageBreak()) doc.build(story) Simone -------------- next part -------------- An HTML attachment was scrubbed... URL: From simone.dalmasso at gmail.com Tue Jul 14 03:36:25 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Tue, 14 Jul 2009 09:36:25 +0200 Subject: [reportlab-users] Spacer too large at page... In-Reply-To: References: Message-ID: Thanks a lot in advance :) 2009/7/14 Simone Dalmasso > Hi list, I built an application which prints some pages depending on the > user request. The pdf is composed of a number of documents separated by a > page break and at the beginning and at the end of each documents some images > are inserted. > I encounter a problem when I ask for a pdf composed of several documents > but always on a specified page. Here is: > Exception Type: LayoutError Exception Value: > > Flowable ... too large on page 6 > > The page 6 contains always the same document, but asking for it alone it > works fine. > Here follows a piece of my code: > > t = Table(data,style = style) > t._argW[0] = 8.5 * cm #first column width > w,h = t.wrap(A4[0]-2*cm,A4[1]) > story.append(header) > story.append(space) > story.append(t) > story.append(space) > story.append(footer) > story.append(PageBreak()) > doc.build(story) > > Simone > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dirk.holtwick at gmail.com Tue Jul 14 11:13:15 2009 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Tue, 14 Jul 2009 17:13:15 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS Message-ID: <4A5CA08B.6020205@gmail.com> Hi, while cleaning up my computer I found some old code I worked on last year. It is not completed but some stuff already works. This is basically a new paragraph implementation based on some kind of box model. It takes a DOM structure with CSS style informations and then renders the corresponding paragraph. Maybe this could become interesting as a sophisticated paragraph replacement in the RL toolkit some time. Here is the code: http://code.google.com/p/xhtml2pdf-base/source/browse/src/xhtml2pdf/paragraph.py The parsing of the HTML and the enriching of the DOM with CSS style information can be done in various ways. In the test implementation I use the html5lib and Techgames CSS parser. But here is an example of how this might be achieved by using lxml and cssutils too. http://code.google.com/p/xhtml2pdf-base/source/browse/helpers/apply_styles.py Genshi might also be a good solution. Here is some CSS to DOM mapping implemented: http://code.google.com/p/pyxer/source/browse/src/pyxer/template/cssselect.py Since I will not find the time to bring this effort to an end quite soon, maybe someone else is interested in helping out here. For now this source is licensed under GPLv2 but it would be okay for me to license some portions under MIT license too, if there is interest in it. Hope you find this helpful. Thanks Dirk From tim at reportlab.com Tue Jul 14 12:22:28 2009 From: tim at reportlab.com (Tim Grant) Date: Tue, 14 Jul 2009 17:22:28 +0100 Subject: [reportlab-users] [reportlab-support] eBrochures Room text second page In-Reply-To: <2CB82A3C73D2D0409FF0F0FC0E283B5620CC2FE7@hwmxmsg11.hotels.ad.hilton.com> References: <2CB82A3C73D2D0409FF0F0FC0E283B5620CC2FE5@hwmxmsg11.hotels.ad.hilton.com> <4A5CA817.7@reportlab.com> <2CB82A3C73D2D0409FF0F0FC0E283B5620CC2FE7@hwmxmsg11.hotels.ad.hilton.com> Message-ID: <4A5CB0C4.1030803@reportlab.com> Hi Thilo, We've actually just spotted a bug...the threshold should be set much higher for this section, as there is plenty of room for more text. This should be fixed shortly. Regards, -Tim ReportLab Europe Ltd. Media House 3 Palmerston Road London SW19 1PG Tel +44-20-8545-1570 Thilo Petersen wrote: > Great thanks for the info Tim! :o) > > -----Original Message----- > From: Tim Grant [mailto:tim at reportlab.com] > Sent: Tuesday, July 14, 2009 4:45 PM > To: Thilo Petersen > Cc: SUPPORT AT REPORTLAB > Subject: Re: [reportlab-support] eBrochures Room text second page > > Hi Thilo, > > The text for room descriptions is indeed truncated, so that it fits into the space next to the picture. > > The text has a maximum length of 300 characters and gets cut off at the nearest full stop. > > Regards, > Tim Grant > ReportLab Europe Ltd. > Media House > 3 Palmerston Road > London SW19 1PG > Tel +44-20-8545-1570 > > > Thilo Petersen wrote: >> >> >> Hi, >> >> I had a request to change the text for the rooms of a couple of hotels >> on the eBrochure to reflect the text on the website. But it appears >> that it only pulls the first sentence of the rooms overview to the >> brochure and not the whole text. I am not sure if that is intentional, >> maybe it was too long for some hotels. Would you know if this is correct as it >> is? >> >> Thanks & kind regards >> >> Thilo >> >> >> >> >> ---------------------------------------------------------------------- >> -- >> >> _______________________________________________ >> reportlab-support mailing list >> reportlab-support at app5.reportlab.com >> http://app5.reportlab.com/mailman/listinfo/reportlab-support >> **NB** attachments under 750kB please From gherman at darwin.in-berlin.de Tue Jul 14 13:18:26 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 14 Jul 2009 19:18:26 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: <4A5CA08B.6020205@gmail.com> References: <4A5CA08B.6020205@gmail.com> Message-ID: Dirk Holtwick: > while cleaning up my computer I found some old code I worked on > last year. It is not completed but some stuff already works. Cool! This reminds me of finalising my paragraph version doing Kerning, see http://twitpic.com/80ppw. It's funny (and/or sad) how many companies I met over the last years who dropped evaluating RL in favour of using other libs like PDFlib simply because of the lack of kerning. Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From marius at gedmin.as Tue Jul 14 17:21:46 2009 From: marius at gedmin.as (Marius Gedminas) Date: Wed, 15 Jul 2009 00:21:46 +0300 Subject: [reportlab-users] Preformatted() with bullets Message-ID: <20090714212145.GA26378@platonas> To get bulleted text we use bullet_text = ParagraphStyle('bullet_text', parent=normal) bullet_text.leftIndent = 36 bullet_text.spaceBefore = 3 bullet_text.bulletIndent = 24 bullet_text.is_bullet = 1 # ReportLab 2.0 wants UTF-8 here, ReportLab 1.20 wanted Windows-1252 bullet_text.bullet_char = u'\u2022'.encode('UTF-8') report_items.append(Paragraph(text, style=bullet_text, bulletText=bullet_text.bullet_char)) and it works fine. (I admit I've no clue why I have to explicitly pass bulletText to the Paragraph when it's already specified in the style. Maybe I should go read the documentation again. In the mean time it works.) Now at some point we needed to change the style of the bulleted paragraphs to show preformatted text (monospaced font, keeping newlines and everything). Unfortunately, if you just substitute Preformatted for Paragraph in the code above, you get no bullets drawn at all. I've wanted to post this fix in proper patch form with tests and everything for *years* now, but I never seem to find the time. So here is the workaround we currently use, in raw form: from reportlab.platypus.flowables import Preformatted as _Preformatted class Preformatted(_Preformatted): def draw(self): offset = self.style.firstLineIndent cur_y = self.height - self.style.fontSize if self.bulletText <> None: offset = _drawBullet(self.canv, offset, cur_y, self.bulletText, self.style) _Preformatted.draw(self) I'll keep trying to find some time to do it properly (patch with tests), but I don't expect it to happen soon. :( Marius Gedminas -- He who sacrifices functionality for ease of use Loses both and deserves neither -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From andy at reportlab.com Wed Jul 15 04:04:43 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 15 Jul 2009 09:04:43 +0100 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: References: <4A5CA08B.6020205@gmail.com> Message-ID: <956003ae0907150104nf5feccbwe483e62e423f4583@mail.gmail.com> 2009/7/14 Dinu Gherman : > It's funny (and/or sad) how many companies I met over the last > years who dropped evaluating RL in favour of using other libs > like PDFlib simply because of the lack of kerning. That's interesting, because in 9 years of building solutions for very picky marketing departments, I can only remember people asking once or twice; and when I explained that there was a performance trade-off and kerning would make it substantially slower they agreed instantly that speed mattered more. Dinu, if people are saying this, is it 'body text' they care about, or occasional use of titles? - Andy From Jason.Brower at kone.com Wed Jul 15 06:38:21 2009 From: Jason.Brower at kone.com (Brower Jason) Date: Wed, 15 Jul 2009 12:38:21 +0200 Subject: [reportlab-users] Inline images not working.. In-Reply-To: <956003ae0907140013j3d9d9f5bt6b410b48dc7eae65@mail.gmail.com> Message-ID: <7BEADC998EA85041A0170E2F5F726D2FBA451D@EUDEXC01.KONENET.COM> Thanks for the help. I upgrade to the newest ubuntu and it came with 2.3 so I am happy to report it is working. Regards, Jason -----Original Message----- From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Andy Robinson Sent: 14/07/2009 10:13 To: Support list for users of Reportlab software Subject: Re: [reportlab-users] Inline images not working.. 2009/7/14 Brower Jason : > According to my Ubuntu 9.04 it is... > 2.1dfsg-2 > Regards, > Jason Brower I have no idea what dfsg-2 means (that's something the Ubuntu packagers mean) but it must be well over a year old. Try 2.3 from www.reportlab.org or our daily builds. - Andy _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From gherman at darwin.in-berlin.de Wed Jul 15 10:29:04 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 15 Jul 2009 16:29:04 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: <956003ae0907150104nf5feccbwe483e62e423f4583@mail.gmail.com> References: <4A5CA08B.6020205@gmail.com> <956003ae0907150104nf5feccbwe483e62e423f4583@mail.gmail.com> Message-ID: Andy Robinson: > Dinu, if people are saying this, is it 'body text' they care about, > or occasional use of titles? It depends on the use case. Of course when the document is mostly about "dumb tables" people don't care about kerning. But as soon as the "reading experience" becomes important the kerning has an impact. The end reader might perhaps not really notice (or maybe not consciously) but the client does and even more so when he is fixed on using specific fonts, first in headlines and immediately after in the body text. I hope I'll be able to prepare some examples, soon, for less font- aware people to see what a difference this makes... Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From ralsina at netmanagers.com.ar Wed Jul 15 10:54:49 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 15 Jul 2009 11:54:49 -0300 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS References: <4A5CA08B.6020205@gmail.com> <956003ae0907150104nf5feccbwe483e62e423f4583@mail.gmail.com> Message-ID: Dinu Gherman writes: > Andy Robinson: > >> Dinu, if people are saying this, is it 'body text' they care about, >> or occasional use of titles? > > > It depends on the use case. Of course when the document is mostly > about "dumb tables" people don't care about kerning. But as soon > as the "reading experience" becomes important the kerning has an > impact. The end reader might perhaps not really notice (or maybe > not consciously) but the client does and even more so when he is > fixed on using specific fonts, first in headlines and immediately > after in the body text. > > I hope I'll be able to prepare some examples, soon, for less font- > aware people to see what a difference this makes... Tis would be very interesting for rst2pdf, since some people are starting to use it for small books. From H.vonBargen at t-p.com Wed Jul 15 11:28:57 2009 From: H.vonBargen at t-p.com (Henning von Bargen) Date: Wed, 15 Jul 2009 17:28:57 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: Message-ID: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> Dinu Gherman wrote: > Cool! This reminds me of finalising my paragraph version doing > Kerning, see http://twitpic.com/80ppw. > It's funny (and/or sad) how many companies I met over the last > years who dropped evaluating RL in favour of using other libs > like PDFlib simply because of the lack of kerning. I'd be happy to integrate a kerning option into the wordaxe Paragraph implementation (this would help rst2pdf as well) after my summer holiday, if you can give me a code example. Do you do automatic kerning based on the font information or is the kerning hand-coded for each pair of glyphs? BTW Dirk's code looks pretty clean, much cleaner than mine... But, at least some of the classes look quite similar to what wordaxe does in the para_fragments.py module. Henning http://deco-cow.sourceforge.net From dirk.holtwick at gmail.com Wed Jul 15 11:42:49 2009 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Wed, 15 Jul 2009 17:42:49 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> Message-ID: <4A5DF8F9.9010507@gmail.com> > BTW Dirk's code looks pretty clean, much cleaner than mine... > But, at least some of the classes look quite similar to what > wordaxe does in the para_fragments.py module. Indeed it can be that I have been inspired by your code, since I have read it by this time. I just tried to break it down into small peaces. Maybe this approach could be useful for an integration with wordaxe and the kerning too. If we replace the DOM input by something more generic this might also fit for rst2pdf. As I said I would be happy to donate this paragraph related code if it is useful somewhere else. Dirk From ralsina at netmanagers.com.ar Wed Jul 15 12:09:17 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 15 Jul 2009 13:09:17 -0300 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> <4A5DF8F9.9010507@gmail.com> Message-ID: Dirk Holtwick writes: >> BTW Dirk's code looks pretty clean, much cleaner than mine... >> But, at least some of the classes look quite similar to what >> wordaxe does in the para_fragments.py module. > > Indeed it can be that I have been inspired by your code, since I have > read it by this time. I just tried to break it down into small peaces. > Maybe this approach could be useful for an integration with wordaxe and > the kerning too. If we replace the DOM input by something more generic > this might also fit for rst2pdf. If it goes into wordaxe, rst2pdf gets it by default :-) From gherman at darwin.in-berlin.de Wed Jul 15 12:20:44 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 15 Jul 2009 18:20:44 +0200 Subject: [reportlab-users] Alternative paragraph implementation with HTML and CSS In-Reply-To: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AF5@ROHRPOSTIX.tup.ads> Message-ID: Henning von Bargen: > Do you do automatic kerning based on the font information > or is the kerning hand-coded for each pair of glyphs? I'm using the kerning table of TrueType fonts, so it doesn't work with other fonts... I've also experimented with over- writing this info with what I sometimes felt was "more approp- riate" info. That would be possible, but quite nitpicking... Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From stephane at harobed.org Mon Jul 20 08:33:07 2009 From: stephane at harobed.org (KLEIN =?iso-8859-1?q?St=E9phane?=) Date: Mon, 20 Jul 2009 12:33:07 +0000 (UTC) Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? Message-ID: Hi, I produce CMYK PDF document and I need to insert CMYK JPG file in my document. I've one simple example : :: from reportlab.pdfgen import canvas from reportlab.lib.units import cm, mm from reportlab.lib.pagesizes import A4 from reportlab.pdfgen.pdfimages import PDFImage c = canvas.Canvas( "test.pdf", pagesize = A4) c.drawString(200, 100, "hello.pdf") img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) img.drawInlineImage(c, preserveAspectRatio = True) c.showPage() c.save() "image_test_cmjn.jpg" is a CMYK image. When I look test.pdf, this image appear converted in RGB. How can I fix this issue ? Do you have one example ? Thanks for your help, Stephane From gherman at darwin.in-berlin.de Mon Jul 20 09:39:09 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 20 Jul 2009 15:39:09 +0200 Subject: [reportlab-users] How-to for adding new features? Message-ID: <930E93D8-D32E-4F0D-984D-552839090440@darwin.in-berlin.de> Hi, I'm thinking about new features for ReportLab, one of them being PDF/A compliance. AFAIK, this is not a given. So, is there any- thing like a document describing "officially" how to add such features in a "canonical" way to the pdfgen module or to any part of the library at all? At least I cannot remember having seen that in the existing documentation produced over the last nine years, but maybe I'm wrong. Thanks, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From andy at reportlab.com Mon Jul 20 11:10:43 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 20 Jul 2009 16:10:43 +0100 Subject: [reportlab-users] How-to for adding new features? In-Reply-To: <930E93D8-D32E-4F0D-984D-552839090440@darwin.in-berlin.de> References: <930E93D8-D32E-4F0D-984D-552839090440@darwin.in-berlin.de> Message-ID: <956003ae0907200810q6d53c642kacd433b009ce019c@mail.gmail.com> 2009/7/20 Dinu Gherman : > Hi, > > I'm thinking about new features for ReportLab, one of them being > PDF/A compliance. AFAIK, this is not a given. So, is there any- > thing like a document describing "officially" how to add such > features in a "canonical" way to the pdfgen module or to any > part of the library at all? At least I cannot remember having > seen that in the existing documentation produced over the last > nine years, but maybe I'm wrong. No such document exists. My excuse is here ;-) http://agilemanifesto.org/ We're also starting work on a bunch of extensions ourselves in August, and this has been on our wish list too. We hope to be adding support for colour models and/or palettes (e.g. "this document is CMYK, so complain if someone loads in an RGB image by mistake...", or "this document has an explicit colour palette, complain if they go outside it...). There are some similarities. In my opinion, when you initialise a canvas, you should be able to say things like c = Canvas(....pdf_version="PDF/A"..) and it should make sure that version (flavour? format?) is respected. In the case of PDF/A, this would have to NOT load the standard fonts, unless the files were present for embedding. I guess in Platypus one could initialise things on the DocTemplate and pass down to the canvas. We have not yet started the detailed work on this but would welcome peoples' thoughts. One of the big gaps is finding a free compliance-checking tool. We can use Acrobat Professional's preflight tools for some things... - Andy From robin at reportlab.com Mon Jul 20 12:31:07 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 20 Jul 2009 17:31:07 +0100 Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? In-Reply-To: References: Message-ID: <4A649BCB.4040105@chamonix.reportlab.co.uk> KLEIN St?phane wrote: > Hi, > > I produce CMYK PDF document and I need to insert CMYK JPG file in my > document. > > I've one simple example : > > :: > > from reportlab.pdfgen import canvas > from reportlab.lib.units import cm, mm > from reportlab.lib.pagesizes import A4 > from reportlab.pdfgen.pdfimages import PDFImage > > c = canvas.Canvas( "test.pdf", pagesize = A4) > c.drawString(200, 100, "hello.pdf") > > img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) > img.drawInlineImage(c, preserveAspectRatio = True) > > c.showPage() > c.save() > > "image_test_cmjn.jpg" is a CMYK image. > When I look test.pdf, this image appear converted in RGB. > > How can I fix this issue ? > > Do you have one example ? > > Thanks for your help, > Stephane ......... We do try to use jpegs natively so something else must be causing this problem. However, the normal way to draw an image is to use the canvas interface directly so that may be part of the problem. In stead of > img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) > img.drawInlineImage(c, preserveAspectRatio = True) we would normally use c.drawInlineImage("image_test_cmjn.jpg", 100, 500, 300, 300, preserveAspectRatio=True) or the alternative c.drawImage("image_test_cmjn.jpg", 100, 500, 300, 300, preserveAspectRatio=True) the latter is the preferred interface lately so may be kinder. Looking in the code it seems your sequence was correct for the drawInline case. -- Robin Becker From gherman at darwin.in-berlin.de Wed Jul 22 05:02:44 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 22 Jul 2009 11:02:44 +0200 Subject: [reportlab-users] How-to for adding new features? In-Reply-To: <956003ae0907200810q6d53c642kacd433b009ce019c@mail.gmail.com> References: <930E93D8-D32E-4F0D-984D-552839090440@darwin.in-berlin.de> <956003ae0907200810q6d53c642kacd433b009ce019c@mail.gmail.com> Message-ID: <2CB359B8-0AC1-4AF3-BC6F-B2E81244A527@darwin.in-berlin.de> Andy Robinson: > No such document exists. My excuse is here ;-) > > http://agilemanifesto.org/ Well, the question is: does it work? If so, there should be a plethora of ReportLab extensions from third parties... In this case I'm still waiting for someone providing me a list of, say, 20 pointers to start with. > One of the big gaps is finding a free compliance-checking tool. We > can use Acrobat Professional's preflight tools for some things... Well, I'm not aware of free validating tools, but if you want to use one in-house why must it be free? I could point you to some companies, even here in Berlin, selling commercial validators, that should be affordable for ReportLab. The pricing model is based on running server cores, so it should be very familiar to RL. ;-) Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdriscoll at co.marshall.ia.us Wed Jul 22 10:57:12 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Wed, 22 Jul 2009 09:57:12 -0500 Subject: [reportlab-users] Splitting a nested table over multiple pages Message-ID: <4A6728C8.2050706@co.marshall.ia.us> Hi, I am working on a program that accepts large datasets and transforms them into nested tables that need to be split across multiple pages in ReportLab. Here's the basic setup: 1) My top level table has four columns and an unknown number of rows 2) In each column is a nested table 3) The nested table has 3 column and an unknown number of rows When I try to feed my table the data, I end up getting the following traceback: IndexError: list index out of range File "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", line 143, in app.MainLoop() File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7967, in MainLoop wx.PyApp.MainLoop(self) File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7292, in MainLoop return _core_.PyApp_MainLoop(*args, **kwargs) File "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", line 113, in onRun pdfGenerator.createPDF(userData) File "V:\PythonPackages\Development\pyRetention\pyRetention\pdfGenerator.py", line 87, in createPDF doc.build(story, onFirstPage=onPageHeader) File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", line 1010, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", line 777, in build self.handle_flowable(flowables) File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", line 665, in handle_flowable if frame.add(f, canv, trySplit=self.allowSplitting): File "c:\Python25\Lib\site-packages\reportlab\platypus\frames.py", line 159, in _add w, h = flowable.wrap(aW, h) File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line 1092, in wrap self._calc(availWidth, availHeight) File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line 571, in _calc W = self._calcPreliminaryWidths(availWidth) #widths File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line 665, in _calcPreliminaryWidths value = self._cellvalues[rowNo][colNo] My outer table is set up like this: mainTbl = Table(data, splitByRow=1) And here's some example data that goes into it: data = [[tblOne, tblTwo, tblThree, tblFour], [ddTblOne, ddTblTwo, ddTblThree, ddTblFour]] I am doing my development on Windows with ReportLab 2.3 and Python 2.5. Suggestions are most welcome. Mike From robin at reportlab.com Wed Jul 22 12:12:17 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 22 Jul 2009 17:12:17 +0100 Subject: [reportlab-users] Splitting a nested table over multiple pages In-Reply-To: <4A6728C8.2050706@co.marshall.ia.us> References: <4A6728C8.2050706@co.marshall.ia.us> Message-ID: <4A673A61.608@chamonix.reportlab.co.uk> Mike Driscoll wrote: > Hi, > > I am working on a program that accepts large datasets and transforms > them into nested tables that need to be split across multiple pages in > ReportLab. Here's the basic setup: > > 1) My top level table has four columns and an unknown number of rows > 2) In each column is a nested table > 3) The nested table has 3 column and an unknown number of rows > > When I try to feed my table the data, I end up getting the following > traceback: > > IndexError: list index out of range > File "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", > line 143, in > app.MainLoop() > File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", > line 7967, in MainLoop > wx.PyApp.MainLoop(self) > File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", > line 7292, in MainLoop > return _core_.PyApp_MainLoop(*args, **kwargs) > File "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", > line 113, in onRun > pdfGenerator.createPDF(userData) > File > "V:\PythonPackages\Development\pyRetention\pyRetention\pdfGenerator.py", > line 87, in createPDF > doc.build(story, onFirstPage=onPageHeader) > File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", > line 1010, in build > BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) > File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", > line 777, in build > self.handle_flowable(flowables) > File "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", > line 665, in handle_flowable > if frame.add(f, canv, trySplit=self.allowSplitting): > File "c:\Python25\Lib\site-packages\reportlab\platypus\frames.py", line > 159, in _add > w, h = flowable.wrap(aW, h) > File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line > 1092, in wrap > self._calc(availWidth, availHeight) > File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line > 571, in _calc > W = self._calcPreliminaryWidths(availWidth) #widths > File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", line > 665, in _calcPreliminaryWidths > value = self._cellvalues[rowNo][colNo] > > My outer table is set up like this: > > mainTbl = Table(data, splitByRow=1) > > And here's some example data that goes into it: > > data = [[tblOne, tblTwo, tblThree, tblFour], [ddTblOne, ddTblTwo, > ddTblThree, ddTblFour]] not sure what's going on here, but you should be aware that the inner tables will never be split as we always split on row boundaries. From the error it looks like one of the tables has something wrong with it. Why not try just outputting the inner tables one by one; if there's an issue there then the traceback might indicate which table is wrong. Could one of the inner tables actually be 0 x 0? ............. -- Robin Becker From ralsina at netmanagers.com.ar Thu Jul 23 10:03:21 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 23 Jul 2009 11:03:21 -0300 Subject: [reportlab-users] Paragraphs with images are too small Message-ID: <200907231103.21525.ralsina@netmanagers.com.ar> This is a bug I reported in may and got no response, thought it would be ok to refresh it. I apologize if it's not. Here's a test case. What you will see is that the image in the second paragraph completely overlaps the first paragrah: from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import getSampleStyleSheet styles = getSampleStyleSheet() def go(): Story=[] doc = SimpleDocTemplate("phello.pdf") style = styles["Normal"] p = Paragraph('This should be above the image', style) Story.append(p) p = Paragraph('', style) Story.append(p) p = Paragraph('This should be below the image', style) Story.append(p) doc.build(Story) go() -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From moshe.wagner at gmail.com Thu Jul 23 10:33:09 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Thu, 23 Jul 2009 17:33:09 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <956003ae0906170847r698d8d43u69d1b998eac9011f@mail.gmail.com> References: <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> <956003ae0906170442l53cb0096iab6502f643a2d7ce@mail.gmail.com> <956003ae0906170847r698d8d43u69d1b998eac9011f@mail.gmail.com> Message-ID: Was there any progress with merging the RTL support patch into the main code? I'm willing to help improve the code if needed, but as mentioned in the past, there are some decisions about RTL to be decided before I can continue. I've just encountered these articles about "BiDi aware programming", maybe they could clear up the subject a bit. http://www.lingnu.com/en/programming.html Moshe From timr at probo.com Thu Jul 23 13:17:14 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 23 Jul 2009 10:17:14 -0700 Subject: [reportlab-users] Paragraphs with images are too small In-Reply-To: <200907231103.21525.ralsina@netmanagers.com.ar> References: <200907231103.21525.ralsina@netmanagers.com.ar> Message-ID: <4A689B1A.3090001@probo.com> Roberto Alsina wrote: > This is a bug I reported in may and got no response, thought it would be ok to > refresh it. I apologize if it's not. > > Here's a test case. What you will see is that the image in the second > paragraph completely overlaps the first paragrah: > As far as I know, a paragraph in Platypus does not adjust its vertical spacing to compensate for inline images. Your image will be drawn with its bottom edge on the baseline of the current line, but the baseline is not moved to make room for that image. If the image is very tall, it will overlap the stuff above it. Thus, the tag is mostly useful for icons and other small inclusions. If you need a large out-of-line image, perhaps you should use the Figure flowable instead. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ralsina at netmanagers.com.ar Thu Jul 23 13:21:20 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 23 Jul 2009 14:21:20 -0300 Subject: [reportlab-users] Paragraphs with images are too small In-Reply-To: <4A689B1A.3090001@probo.com> References: <200907231103.21525.ralsina@netmanagers.com.ar> <4A689B1A.3090001@probo.com> Message-ID: <200907231421.20456.ralsina@netmanagers.com.ar> On Thursday 23 July 2009 14:17:14 Tim Roberts wrote: > Roberto Alsina wrote: > > This is a bug I reported in may and got no response, thought it would be > > ok to refresh it. I apologize if it's not. > > > > Here's a test case. What you will see is that the image in the second > > paragraph completely overlaps the first paragrah: > > As far as I know, a paragraph in Platypus does not adjust its vertical > spacing to compensate for inline images. Your image will be drawn with > its bottom edge on the baseline of the current line, but the baseline is > not moved to make room for that image. If the image is very tall, it > will overlap the stuff above it. Thus, the tag is mostly useful > for icons and other small inclusions. Yes, that is the bug, and (IMHO) it should adjust it :-) Since it already adjusts when it runs into the tag, maybe it could do the same thing when it finds the tag, too. > If you need a large out-of-line image, perhaps you should use the Figure > flowable instead. I suggest that whenever the problem arises for rst2pdf users, but in the case of automatically generated documents this sometimes can't be done. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From mdriscoll at co.marshall.ia.us Thu Jul 23 14:13:57 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 23 Jul 2009 13:13:57 -0500 Subject: [reportlab-users] Splitting a nested table over multiple pages In-Reply-To: <4A673A61.608@chamonix.reportlab.co.uk> References: <4A6728C8.2050706@co.marshall.ia.us> <4A673A61.608@chamonix.reportlab.co.uk> Message-ID: <4A68A865.5050405@co.marshall.ia.us> Robin Becker wrote: > Mike Driscoll wrote: >> Hi, >> >> I am working on a program that accepts large datasets and transforms >> them into nested tables that need to be split across multiple pages >> in ReportLab. Here's the basic setup: >> >> 1) My top level table has four columns and an unknown number of rows >> 2) In each column is a nested table >> 3) The nested table has 3 column and an unknown number of rows >> >> When I try to feed my table the data, I end up getting the following >> traceback: >> >> IndexError: list index out of range >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", >> line 143, in >> app.MainLoop() >> File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", >> line 7967, in MainLoop >> wx.PyApp.MainLoop(self) >> File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", >> line 7292, in MainLoop >> return _core_.PyApp_MainLoop(*args, **kwargs) >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", >> line 113, in onRun >> pdfGenerator.createPDF(userData) >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pdfGenerator.py", >> line 87, in createPDF >> doc.build(story, onFirstPage=onPageHeader) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 1010, in build >> BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 777, in build >> self.handle_flowable(flowables) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 665, in handle_flowable >> if frame.add(f, canv, trySplit=self.allowSplitting): >> File "c:\Python25\Lib\site-packages\reportlab\platypus\frames.py", >> line 159, in _add >> w, h = flowable.wrap(aW, h) >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 1092, in wrap >> self._calc(availWidth, availHeight) >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 571, in _calc >> W = self._calcPreliminaryWidths(availWidth) #widths >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 665, in _calcPreliminaryWidths >> value = self._cellvalues[rowNo][colNo] >> >> My outer table is set up like this: >> >> mainTbl = Table(data, splitByRow=1) >> >> And here's some example data that goes into it: >> >> data = [[tblOne, tblTwo, tblThree, tblFour], [ddTblOne, ddTblTwo, >> ddTblThree, ddTblFour]] > > not sure what's going on here, but you should be aware that the inner > tables will never be split as we always split on row boundaries. From > the error it looks like one of the tables has something wrong with it. I am aware that the inner tables won't split by row...that's why I told the outer table to do that. > > Why not try just outputting the inner tables one by one; if there's an > issue there then the traceback might indicate which table is wrong. > Could one of the inner tables actually be 0 x 0? > ............. > I have a check for empty tables in my script that will put dummy data in if it encounters nothing. I'll try outputting the inner tables, but it doesn't crash until I actually run build. Mike From mdriscoll at co.marshall.ia.us Thu Jul 23 17:32:29 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 23 Jul 2009 16:32:29 -0500 Subject: [reportlab-users] Splitting a nested table over multiple pages In-Reply-To: <4A673A61.608@chamonix.reportlab.co.uk> References: <4A6728C8.2050706@co.marshall.ia.us> <4A673A61.608@chamonix.reportlab.co.uk> Message-ID: <4A68D6ED.9040302@co.marshall.ia.us> Robin Becker wrote: > Mike Driscoll wrote: >> Hi, >> >> I am working on a program that accepts large datasets and transforms >> them into nested tables that need to be split across multiple pages >> in ReportLab. Here's the basic setup: >> >> 1) My top level table has four columns and an unknown number of rows >> 2) In each column is a nested table >> 3) The nested table has 3 column and an unknown number of rows >> >> When I try to feed my table the data, I end up getting the following >> traceback: >> >> IndexError: list index out of range >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", >> line 143, in >> app.MainLoop() >> File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", >> line 7967, in MainLoop >> wx.PyApp.MainLoop(self) >> File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", >> line 7292, in MainLoop >> return _core_.PyApp_MainLoop(*args, **kwargs) >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pyreGUI.py", >> line 113, in onRun >> pdfGenerator.createPDF(userData) >> File >> "V:\PythonPackages\Development\pyRetention\pyRetention\pdfGenerator.py", >> line 87, in createPDF >> doc.build(story, onFirstPage=onPageHeader) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 1010, in build >> BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 777, in build >> self.handle_flowable(flowables) >> File >> "c:\Python25\Lib\site-packages\reportlab\platypus\doctemplate.py", >> line 665, in handle_flowable >> if frame.add(f, canv, trySplit=self.allowSplitting): >> File "c:\Python25\Lib\site-packages\reportlab\platypus\frames.py", >> line 159, in _add >> w, h = flowable.wrap(aW, h) >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 1092, in wrap >> self._calc(availWidth, availHeight) >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 571, in _calc >> W = self._calcPreliminaryWidths(availWidth) #widths >> File "c:\Python25\Lib\site-packages\reportlab\platypus\tables.py", >> line 665, in _calcPreliminaryWidths >> value = self._cellvalues[rowNo][colNo] >> >> My outer table is set up like this: >> >> mainTbl = Table(data, splitByRow=1) >> >> And here's some example data that goes into it: >> >> data = [[tblOne, tblTwo, tblThree, tblFour], [ddTblOne, ddTblTwo, >> ddTblThree, ddTblFour]] > > not sure what's going on here, but you should be aware that the inner > tables will never be split as we always split on row boundaries. From > the error it looks like one of the tables has something wrong with it. > > Why not try just outputting the inner tables one by one; if there's an > issue there then the traceback might indicate which table is wrong. > Could one of the inner tables actually be 0 x 0? > ............. > Okay...I went through all the tables in this query and I'm not seeing it. Maybe a fresh pair of eyes is in order. I've pasted my output here: http://paste.pocoo.org/show/130422/ These are the nested tables, which I stick into the mainTbl like this: innerTableData = [["Earnings", "Earnings", "Earnings", "Earnings"], earningTables, ["Deductions", "Deductions", "Deductions", "Deductions"], deductionTables ] mainTbl = Table(innerTableData, splitByRow=1) story.append(mainTbl) I'm sure all I need is a drubbing from the clue stick. Hopefully someone has one handy. - Mike From robin at reportlab.com Fri Jul 24 04:44:31 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 24 Jul 2009 09:44:31 +0100 Subject: [reportlab-users] Paragraphs with images are too small In-Reply-To: <4A689B1A.3090001@probo.com> References: <200907231103.21525.ralsina@netmanagers.com.ar> <4A689B1A.3090001@probo.com> Message-ID: <4A69746F.9060800@chamonix.reportlab.co.uk> Tim Roberts wrote: > Roberto Alsina wrote: >> This is a bug I reported in may and got no response, thought it would be ok to >> refresh it. I apologize if it's not. >> >> Here's a test case. What you will see is that the image in the second >> paragraph completely overlaps the first paragrah: >> > > As far as I know, a paragraph in Platypus does not adjust its vertical > spacing to compensate for inline images. Your image will be drawn with > its bottom edge on the baseline of the current line, but the baseline is > not moved to make room for that image. If the image is very tall, it > will overlap the stuff above it. Thus, the tag is mostly useful > for icons and other small inclusions. > > If you need a large out-of-line image, perhaps you should use the Figure > flowable instead. > There is an extra style setting to allow the line heights to adjust with the fontSize and image heights. Try setting autoLeading='max' on the style. -- Robin Becker From ralsina at netmanagers.com.ar Fri Jul 24 08:53:22 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 24 Jul 2009 09:53:22 -0300 Subject: [reportlab-users] Paragraphs with images are too small In-Reply-To: <4A69746F.9060800@chamonix.reportlab.co.uk> References: <200907231103.21525.ralsina@netmanagers.com.ar> <4A689B1A.3090001@probo.com> <4A69746F.9060800@chamonix.reportlab.co.uk> Message-ID: <200907240953.22504.ralsina@netmanagers.com.ar> On Friday 24 July 2009 05:44:31 Robin Becker wrote: > Tim Roberts wrote: > > Roberto Alsina wrote: > >> This is a bug I reported in may and got no response, thought it would be > >> ok to refresh it. I apologize if it's not. > >> > >> Here's a test case. What you will see is that the image in the second > >> paragraph completely overlaps the first paragrah: > > > > As far as I know, a paragraph in Platypus does not adjust its vertical > > spacing to compensate for inline images. Your image will be drawn with > > its bottom edge on the baseline of the current line, but the baseline is > > not moved to make room for that image. If the image is very tall, it > > will overlap the stuff above it. Thus, the tag is mostly useful > > for icons and other small inclusions. > > > > If you need a large out-of-line image, perhaps you should use the Figure > > flowable instead. > > There is an extra style setting to allow the line heights to adjust with > the fontSize and image heights. > > Try setting autoLeading='max' on the style. With autoLeading='max' there is no overlapping except for the descending parts of letters, the previous paragraph's baseline is flush with the image. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From ralsina at netmanagers.com.ar Fri Jul 24 23:39:33 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sat, 25 Jul 2009 00:39:33 -0300 Subject: [reportlab-users] Possible bug in line wrapping Message-ID: <200907250039.34019.ralsina@netmanagers.com.ar> This is hard to trigger, but it seems that if there is a linebreak immediately after a link, the line doesn't break. Here is a test case which produced the attached PDF: # -*- coding: utf-8 -*- from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import ParagraphStyle from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.enums import TA_JUSTIFY def go(): styles = getSampleStyleSheet() doc = SimpleDocTemplate("phello.pdf") style = styles['Normal'] style.alignment=TA_JUSTIFY p1 = Paragraph('''PADDING PADDING PADDING PADDING PADDING PADDING The computer will always be better than you at parsing SQL and the bad guys have years of experience finding and using SQL injection attacks in ways you never even thought possible.''', style) doc.build([p1,]) go() -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) -------------- next part -------------- A non-text attachment was scrubbed... Name: phello.pdf Type: application/pdf Size: 2524 bytes Desc: not available Url : From mark at nextra.sk Sun Jul 26 03:55:47 2009 From: mark at nextra.sk (Mark) Date: Sun, 26 Jul 2009 09:55:47 +0200 Subject: [reportlab-users] support for python 3 Message-ID: <1153477526.20090726095547@nextra.sk> Hello, I'd like to ask when the support for Python 3 is planned for ReportLab Toolkit? Thanks in advance for the information, Mark From robin at reportlab.com Mon Jul 27 05:28:51 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 27 Jul 2009 10:28:51 +0100 Subject: [reportlab-users] Possible bug in line wrapping In-Reply-To: <200907250039.34019.ralsina@netmanagers.com.ar> References: <200907250039.34019.ralsina@netmanagers.com.ar> Message-ID: <4A6D7353.6000601@chamonix.reportlab.co.uk> Roberto Alsina wrote: > This is hard to trigger, but it seems that if there is a linebreak immediately > after a link, the line doesn't break. > > Here is a test case which produced the attached PDF: > ........ > go() ....... yes that looks like a bug. Modifying your example shows it's the second a tag that causes the problem > from reportlab.platypus import SimpleDocTemplate, Paragraph > from reportlab.lib.styles import ParagraphStyle > from reportlab.lib.styles import getSampleStyleSheet > from reportlab.lib.enums import TA_JUSTIFY > > def go(): > styles = getSampleStyleSheet() > doc = SimpleDocTemplate("phello.pdf") > style = styles['Normal'] > style.alignment=TA_JUSTIFY > p1 = Paragraph('''PADDING PADDING PADDING PADDING PADDING PADDING The > computer will always be better than you at parsing SQL > and the bad guys have years of experience finding and using href="http://en.wikipedia.org/wiki/SQL_injection" color="navy">SQL > injection attacks in > ways you never even thought possible.''', style) > p2 = Paragraph('''PADDING PADDING PADDING PADDING PADDING PADDING The > computer will always be better than you at parsing SQL > and the bad guys have years of experience finding and using SQL > injection attacks in > ways you never even thought possible.''', style) > p3 = Paragraph('''PADDING PADDING PADDING PADDING PADDING PADDING The > computer will always be better than you at parsing SQL > and the bad guys have years of experience finding and using SQL > injection attacksin > ways you never even thought possible.''', style) > doc.build([p1,p2,p3]) > > go() p1 and p2 cause a problem so the first tag is not a cause as in p2 it's replaced by . In p3 eplacing the second tag by allows the break to happen. Given that the anchor form was recently added I tried the following fix in paragraph line 237 change elif kind=='img': to elif kind in ('img','anchor'): which seems to fix the problem at least in this example. Can you see if this resolves the problem for you? -- Robin Becker From ralsina at netmanagers.com.ar Mon Jul 27 07:28:07 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 27 Jul 2009 08:28:07 -0300 Subject: [reportlab-users] Possible bug in line wrapping In-Reply-To: <4A6D7353.6000601@chamonix.reportlab.co.uk> References: <200907250039.34019.ralsina@netmanagers.com.ar> <4A6D7353.6000601@chamonix.reportlab.co.uk> Message-ID: <200907270828.07680.ralsina@netmanagers.com.ar> On Monday 27 July 2009 06:28:51 Robin Becker wrote: > elif kind in ('img','anchor'): > > which seems to fix the problem at least in this example. Can you see if > this resolves the problem for you? Yes that fixes it. Thanks! -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From stephane at harobed.org Mon Jul 27 09:16:03 2009 From: stephane at harobed.org (KLEIN =?iso-8859-1?q?St=E9phane?=) Date: Mon, 27 Jul 2009 13:16:03 +0000 (UTC) Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? References: Message-ID: Le Mon, 20 Jul 2009 12:33:07 +0000, KLEIN St?phane a ?crit?: > Hi, > > I produce CMYK PDF document and I need to insert CMYK JPG file in my > document. > > I've one simple example : > > :: > > from reportlab.pdfgen import canvas > from reportlab.lib.units import cm, mm from reportlab.lib.pagesizes > import A4 from reportlab.pdfgen.pdfimages import PDFImage > > c = canvas.Canvas( "test.pdf", pagesize = A4) c.drawString(200, 100, > "hello.pdf") > > img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) > img.drawInlineImage(c, preserveAspectRatio = True) > > c.showPage() > c.save() > > "image_test_cmjn.jpg" is a CMYK image. When I look test.pdf, this image > appear converted in RGB. > > How can I fix this issue ? I fixed my issue with : $ convert myfile.jpg -resize 100% myfile.jpg The "convert" is imagemagick utils. I don't understand why this fix my issue, maybe error in my jpg... Regards, Stephane From cwurld at yahoo.com Mon Jul 27 09:35:32 2009 From: cwurld at yahoo.com (Chuck Martin) Date: Mon, 27 Jul 2009 06:35:32 -0700 (PDT) Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? In-Reply-To: References: Message-ID: <962841.13562.qm@web111409.mail.gq1.yahoo.com> I believe that jpg does not support cmyk. When I want CMYK I use tif. Since there is no perfect mapping from RGB to CMYK, my images start out as eps with CMYK colors. Then I use ghostscript to convert them to tif. If your images start out as RGB bitmaps, then there is less benefit in converting them to tif. Chuck ----- Original Message ---- From: KLEIN St?phane To: reportlab-users at reportlab.com Sent: Monday, July 27, 2009 8:16:03 AM Subject: Re: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? Le Mon, 20 Jul 2009 12:33:07 +0000, KLEIN St?phane a ?crit : > Hi, > > I produce CMYK PDF document and I need to insert CMYK JPG file in my > document. > > I've one simple example : > > :: > > from reportlab.pdfgen import canvas > from reportlab.lib.units import cm, mm from reportlab.lib.pagesizes > import A4 from reportlab.pdfgen.pdfimages import PDFImage > > c = canvas.Canvas( "test.pdf", pagesize = A4) c.drawString(200, 100, > "hello.pdf") > > img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) > img.drawInlineImage(c, preserveAspectRatio = True) > > c.showPage() > c.save() > > "image_test_cmjn.jpg" is a CMYK image. When I look test.pdf, this image > appear converted in RGB. > > How can I fix this issue ? I fixed my issue with : $ convert myfile.jpg -resize 100% myfile.jpg The "convert" is imagemagick utils. I don't understand why this fix my issue, maybe error in my jpg... Regards, Stephane _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From stephane at harobed.org Mon Jul 27 11:26:27 2009 From: stephane at harobed.org (KLEIN =?iso-8859-1?q?St=E9phane?=) Date: Mon, 27 Jul 2009 15:26:27 +0000 (UTC) Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? References: <962841.13562.qm@web111409.mail.gq1.yahoo.com> Message-ID: Le Mon, 27 Jul 2009 06:35:32 -0700, Chuck Martin a ?crit?: > I believe that jpg does not support cmyk. When I want CMYK I use tif. > > Since there is no perfect mapping from RGB to CMYK, my images start out > as eps with CMYK colors. Then I use ghostscript to convert them to tif. > If your images start out as RGB bitmaps, then there is less benefit in > converting them to tif. My jpg image is a real CMYK image. JPG support CMYK color space. Regards, Stephane From Jason.Brower at kone.com Tue Jul 28 01:06:34 2009 From: Jason.Brower at kone.com (Brower Jason) Date: Tue, 28 Jul 2009 07:06:34 +0200 Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdfdocument ? In-Reply-To: <962841.13562.qm@web111409.mail.gq1.yahoo.com> Message-ID: <7BEADC998EA85041A0170E2F5F726D2FE6A04B@EUDEXC01.KONENET.COM> As far as I know yes, there is such a thing as cmyk jpeg. At least I have done the conversions. You can use imagemagick with adobe's provided tools to make the conversions in imagemagick and linux. But I could be wrong, I am too busy to google today. Regards, JAson -----Original Message----- From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Chuck Martin Sent: 27/07/2009 16:36 To: Support list for users of Reportlab software Subject: Re: [reportlab-users] How can I insert CMYK JPG in CMYK pdfdocument ? I believe that jpg does not support cmyk. When I want CMYK I use tif. Since there is no perfect mapping from RGB to CMYK, my images start out as eps with CMYK colors. Then I use ghostscript to convert them to tif. If your images start out as RGB bitmaps, then there is less benefit in converting them to tif. Chuck ----- Original Message ---- From: KLEIN St?phane To: reportlab-users at reportlab.com Sent: Monday, July 27, 2009 8:16:03 AM Subject: Re: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? Le Mon, 20 Jul 2009 12:33:07 +0000, KLEIN St?phane a ?crit : > Hi, > > I produce CMYK PDF document and I need to insert CMYK JPG file in my > document. > > I've one simple example : > > :: > > from reportlab.pdfgen import canvas > from reportlab.lib.units import cm, mm from reportlab.lib.pagesizes > import A4 from reportlab.pdfgen.pdfimages import PDFImage > > c = canvas.Canvas( "test.pdf", pagesize = A4) c.drawString(200, 100, > "hello.pdf") > > img = PDFImage("image_test_cmjn.jpg", 100, 500, 300, 300) > img.drawInlineImage(c, preserveAspectRatio = True) > > c.showPage() > c.save() > > "image_test_cmjn.jpg" is a CMYK image. When I look test.pdf, this image > appear converted in RGB. > > How can I fix this issue ? I fixed my issue with : $ convert myfile.jpg -resize 100% myfile.jpg The "convert" is imagemagick utils. I don't understand why this fix my issue, maybe error in my jpg... Regards, Stephane _______________________________________________ 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 volker.haas at brainbot.com Tue Jul 28 03:13:59 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 28 Jul 2009 09:13:59 +0200 Subject: [reportlab-users] cjk splitting problem Message-ID: <4A6EA537.4040906@brainbot.com> I believe I just ran into a bug when trying to render some japanese text. Splitting a paragraph (pagebreak) seems to fail when * paragraph.style.wordWrap = 'CJK' * the paragraph contains mulitple "fragments" (links, images or simple tags in my example) See the attached minimal example. Regards, Volker -- volker haas brainbot technologies ag fon +49 6131 2116394 boppstra?e 64 fax +49 6131 2116392 55118 mainz volker.haas at brainbot.com http://www.brainbot.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: cjk_splitting.py Type: text/x-python Size: 620 bytes Desc: not available Url : From volker.haas at brainbot.com Tue Jul 28 03:27:45 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 28 Jul 2009 09:27:45 +0200 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A6EA537.4040906@brainbot.com> References: <4A6EA537.4040906@brainbot.com> Message-ID: <4A6EA871.8010500@brainbot.com> I forgot to include the traceback: ~/hg/reportlab_tests/ python cjk_splitting.py Traceback (most recent call last): File "cjk_splitting.py", line 21, in doc.build(elements) File "/home/volker/py26/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 1029, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) File "/home/volker/py26/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 796, in build self.handle_flowable(flowables) File "/home/volker/py26/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 702, in handle_flowable raise LayoutError(ident) reportlab.platypus.doctemplate.LayoutError: Splitting error(n==2) on page 1 in bla blub bla blub bla blub bla blub bla blub bla blub bla bl The test was done using the latest svn version of reportlab on a ubuntu machine. Regards, Volker Volker Haas wrote: > I believe I just ran into a bug when trying to render some japanese > text. Splitting a paragraph (pagebreak) seems to fail when > > * paragraph.style.wordWrap = 'CJK' > * the paragraph contains mulitple "fragments" (links, images or simple > tags in my example) > > See the attached minimal example. > > Regards, > Volker > > ------------------------------------------------------------------------ > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users -- volker haas brainbot technologies ag fon +49 6131 2116394 boppstra?e 64 fax +49 6131 2116392 55118 mainz volker.haas at brainbot.com http://www.brainbot.com/ From stephane at harobed.org Tue Jul 28 03:40:21 2009 From: stephane at harobed.org (KLEIN =?iso-8859-1?q?St=E9phane?=) Date: Tue, 28 Jul 2009 07:40:21 +0000 (UTC) Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdf document ? References: <962841.13562.qm@web111409.mail.gq1.yahoo.com> Message-ID: Le Mon, 27 Jul 2009 06:35:32 -0700, Chuck Martin a ?crit?: > I believe that jpg does not support cmyk. When I want CMYK I use tif. > > Since there is no perfect mapping from RGB to CMYK, my images start out > as eps with CMYK colors. Then I use ghostscript to convert them to tif. > If your images start out as RGB bitmaps, then there is less benefit in > converting them to tif. Exemple : stephane at stephane-desktop:$ identify -verbose 001.jpg Image: 001.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Class: DirectClass Geometry: 768x591+0+0 Resolution: 300x300 Print size: 2.56x1.97 Units: PixelsPerInch Type: ColorSeparation Endianess: Undefined Colorspace: CMYK Depth: 8-bit Channel depth: cyan: 8-bit magenta: 8-bit yellow: 8-bit black: 8-bit Channel statistics: cyan: min: 0 (0) max: 252 (0.988235) mean: 152.341 (0.597416) standard deviation: 60.3994 (0.236861) magenta: min: 0 (0) max: 255 (1) mean: 140.976 (0.552848) standard deviation: 57.7572 (0.226499) yellow: min: 0 (0) max: 255 (1) mean: 149.838 (0.5876) standard deviation: 60.2478 (0.236266) black: min: 0 (0) max: 252 (0.988235) mean: 159.42 (0.625175) standard deviation: 82.0791 (0.321879) Total ink density: 324% Rendering intent: Undefined Interlace: None Background color: white Border color: cmyk(223,223,223,0) Matte color: grey74 Transparent color: black Page geometry: 768x591+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 85 ... From robin at reportlab.com Tue Jul 28 05:10:04 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 28 Jul 2009 10:10:04 +0100 Subject: [reportlab-users] How can I insert CMYK JPG in CMYK pdfdocument ? In-Reply-To: <7BEADC998EA85041A0170E2F5F726D2FE6A04B@EUDEXC01.KONENET.COM> References: <7BEADC998EA85041A0170E2F5F726D2FE6A04B@EUDEXC01.KONENET.COM> Message-ID: <4A6EC06C.3050306@chamonix.reportlab.co.uk> Brower Jason wrote: > As far as I know yes, there is such a thing as cmyk jpeg. At least I have done the conversions. You can use imagemagick with adobe's provided tools to make the conversions in imagemagick and linux. > But I could be wrong, I am too busy to google today. > Regards, > JAson > CMYK jpeg is perfectly real and we do attempt to support it. ....... There are a number of issues related including the fact that the colour values are often reversed ie we need to use 1-value rather than value. I suspect that stephane's images have some tag which is wrong for acrobat and converting makes them readable. -- Robin Becker From robin at reportlab.com Tue Jul 28 05:12:35 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 28 Jul 2009 10:12:35 +0100 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A6EA537.4040906@brainbot.com> References: <4A6EA537.4040906@brainbot.com> Message-ID: <4A6EC103.2010109@chamonix.reportlab.co.uk> Volker Haas wrote: > I believe I just ran into a bug when trying to render some japanese > text. Splitting a paragraph (pagebreak) seems to fail when > > * paragraph.style.wordWrap = 'CJK' > * the paragraph contains mulitple "fragments" (links, images or simple > tags in my example) > > See the attached minimal example. > > Regards, > Volker ....... thanks for the example. Andy the expert on CJK is away right now, but I think I did the expansion to multi-fragment so it's probably my bug. I'll try and take a look sooner rather than later. -- Robin Becker From volker.haas at brainbot.com Tue Jul 28 05:33:22 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 28 Jul 2009 11:33:22 +0200 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A6EC103.2010109@chamonix.reportlab.co.uk> References: <4A6EA537.4040906@brainbot.com> <4A6EC103.2010109@chamonix.reportlab.co.uk> Message-ID: <4A6EC5E2.1030902@brainbot.com> Robin Becker wrote: > ....... > thanks for the example. Andy the expert on CJK is away right now, but > I think I did the expansion to multi-fragment so it's probably my bug. > I'll try and take a look sooner rather than later. Thanks for looking into the issue. While your at it: I spotted another potential bug, but I didn't construct a minimal example so far. But maybe the bug is obvious without an example: In the "breakLinesCJK" method in paragraph.py the paragraph height (self.height) is set too late in certain circumstances. I moved self.height = 0 above the two return statements - this fixes the problem. See the diff below. If a minimal example is required I'll try to supply one. Regards, Volker Index: src/reportlab/platypus/paragraph.py =================================================================== --- src/reportlab/platypus/paragraph.py (revision 3516) +++ src/reportlab/platypus/paragraph.py (working copy) @@ -1222,6 +1222,7 @@ if not isinstance(width,(list,tuple)): maxWidths = [width] else: maxWidths = width style = self.style + self.height = 0 #for bullets, work out width and ensure we wrap the right amount onto line one _handleBulletWidth(self.bulletText, style, maxWidths) @@ -1241,8 +1242,6 @@ lines = [] lineno = 0 - self.height = 0 - f = self.frags[0] if hasattr(f,'text'): -- volker haas brainbot technologies ag fon +49 6131 2116394 boppstra?e 64 fax +49 6131 2116392 55118 mainz volker.haas at brainbot.com http://www.brainbot.com/ From eksortso at gmail.com Tue Jul 28 14:57:39 2009 From: eksortso at gmail.com (David Ostroske) Date: Tue, 28 Jul 2009 14:57:39 -0400 Subject: [reportlab-users] Turn off automatic mailto links? Message-ID: Can somebody please show me how to write email addresses (or strings that look like email addresses) without having them treated like mailto links in Adobe Reader? The documentation contains email addresses without links, so it must be possible. But code as simple as the following makes a mailto link out of example at example.com automatically. from reportlab.platypus.doctemplate import SimpleDocTemplate from reportlab.platypus.paragraph import Paragraph from reportlab.lib.styles import ParagraphStyle doc = SimpleDocTemplate('C:/TEMP/test.pdf') defaultstyle = ParagraphStyle(name='default') story = [Paragraph("example at example.com", defaultstyle)] doc.build(story) -- Dave O From eksortso at gmail.com Tue Jul 28 15:01:57 2009 From: eksortso at gmail.com (David Ostroske) Date: Tue, 28 Jul 2009 15:01:57 -0400 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: References: Message-ID: Sorry, but I must correct myself. The email addresses in reportlab-userguide.pdf ARE mailto links. So then, is it even possible to escape email-like text so it is not treated as a mailto link? On Tue, Jul 28, 2009 at 2:57 PM, David Ostroske wrote: [...] > The documentation contains email addresses without links, so it must > be possible. But code as simple as the following makes a mailto link > out of example at example.com automatically. -- Dave O From robin at reportlab.com Wed Jul 29 06:25:36 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 29 Jul 2009 11:25:36 +0100 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: References: Message-ID: <4A7023A0.1020400@chamonix.reportlab.co.uk> David Ostroske wrote: > Can somebody please show me how to write email addresses (or strings > that look like email addresses) without having them treated like > mailto links in Adobe Reader? > > The documentation contains email addresses without links, so it must > be possible. But code as simple as the following makes a mailto link > out of example at example.com automatically. > > from reportlab.platypus.doctemplate import SimpleDocTemplate > from reportlab.platypus.paragraph import Paragraph > from reportlab.lib.styles import ParagraphStyle > > doc = SimpleDocTemplate('C:/TEMP/test.pdf') > defaultstyle = ParagraphStyle(name='default') > story = [Paragraph("example at example.com", defaultstyle)] > doc.build(story) ....... I'm fairly sure that is being done by the display application rather than anything we do. I looked at what's produced by your example > BT 1 0 0 1 0 5.17 Tm /F2 10 Tf 12 TL (example at example.com) Tj T* ET so our code isn't doing anything to promote the idea that we want a link. Even so, acrobat demented reader insists on showing it as a clickable mailto link. I've tried a few experiments and nothing obvious seems to do the right thing. -- Robin Becker From mjf at pearson.co.uk Wed Jul 29 07:13:23 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Wed, 29 Jul 2009 12:13:23 +0100 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: <4A7023A0.1020400@chamonix.reportlab.co.uk> References: <4A7023A0.1020400@chamonix.reportlab.co.uk> Message-ID: <4A702ED3.8040900@pearson.co.uk> Robin Becker wrote: > David Ostroske wrote: >> Can somebody please show me how to write email addresses (or strings >> that look like email addresses) without having them treated like >> mailto links in Adobe Reader? >> > > I'm fairly sure that is being done by the display application rather > than anything we do. It is. There's a option in Adobe Reader (version 8, anyway): Edit -> Preferences -> General -> Create links from URLs which is on by default. -- Matt Folwell From ralsina at netmanagers.com.ar Wed Jul 29 08:40:30 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 29 Jul 2009 09:40:30 -0300 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: <4A7023A0.1020400@chamonix.reportlab.co.uk> References: <4A7023A0.1020400@chamonix.reportlab.co.uk> Message-ID: <200907290940.30417.ralsina@netmanagers.com.ar> On Wednesday 29 July 2009 07:25:36 Robin Becker wrote: > I'm fairly sure that is being done by the display application rather than > anything we do. I looked at what's produced by your example > > > BT 1 0 0 1 0 5.17 Tm /F2 10 Tf 12 TL (example at example.com) Tj T* ET > > so our code isn't doing anything to promote the idea that we want a link. > Even so, acrobat demented reader insists on showing it as a clickable > mailto link. I've tried a few experiments and nothing obvious seems to do > the right thing. How about replacing the @ with a unicode homograph? I am not even sure there is one, and the font problems would be ghastly, though. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From robin at reportlab.com Wed Jul 29 09:33:30 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 29 Jul 2009 14:33:30 +0100 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: <200907290940.30417.ralsina@netmanagers.com.ar> References: <4A7023A0.1020400@chamonix.reportlab.co.uk> <200907290940.30417.ralsina@netmanagers.com.ar> Message-ID: <4A704FAA.5050006@chamonix.reportlab.co.uk> Roberto Alsina wrote: > On Wednesday 29 July 2009 07:25:36 Robin Becker wrote: >> I'm fairly sure that is being done by the display application rather than >> anything we do. I looked at what's produced by your example >> >> > BT 1 0 0 1 0 5.17 Tm /F2 10 Tf 12 TL (example at example.com) Tj T* ET >> >> so our code isn't doing anything to promote the idea that we want a link. >> Even so, acrobat demented reader insists on showing it as a clickable >> mailto link. I've tried a few experiments and nothing obvious seems to do >> the right thing. > > How about replacing the @ with a unicode homograph? I am not even sure there > is one, and the font problems would be ghastly, though. > I'm almost sure that would work as would using an image of the right size. I've tried fakery like person@email.com, but though the text is broken up into separate chunks, acrobat still sees it as a link. The only problem with the homograph ide is that most fonts won't have one easily. I suppose we could modify the encoding to support the right behaviour and or embed a single glyph etc etc. Even if we over come that we then have a document where if we search for example at example.com then it wouldn't be found even though it's in plain view. -- Robin Becker From ralsina at netmanagers.com.ar Wed Jul 29 09:36:55 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 29 Jul 2009 10:36:55 -0300 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: <4A704FAA.5050006@chamonix.reportlab.co.uk> References: <200907290940.30417.ralsina@netmanagers.com.ar> <4A704FAA.5050006@chamonix.reportlab.co.uk> Message-ID: <200907291036.55363.ralsina@netmanagers.com.ar> On Wednesday 29 July 2009 10:33:30 Robin Becker wrote: > Roberto Alsina wrote: > > On Wednesday 29 July 2009 07:25:36 Robin Becker wrote: > >> I'm fairly sure that is being done by the display application rather > >> than anything we do. I looked at what's produced by your example > >> > >> > BT 1 0 0 1 0 5.17 Tm /F2 10 Tf 12 TL (example at example.com) Tj T* ET > >> > >> so our code isn't doing anything to promote the idea that we want a > >> link. Even so, acrobat demented reader insists on showing it as a > >> clickable mailto link. I've tried a few experiments and nothing obvious > >> seems to do the right thing. > > > > How about replacing the @ with a unicode homograph? I am not even sure > > there is one, and the font problems would be ghastly, though. > > I'm almost sure that would work as would using an image of the right size. > I've tried fakery like person@email.com, but though the text > is broken up into separate chunks, acrobat still sees it as a link. > > The only problem with the homograph ide is that most fonts won't have one > easily. I suppose we could modify the encoding to support the right > behaviour and or embed a single glyph etc etc. > > Even if we over come that we then have a document where if we search for > example at example.com then it wouldn't be found even though it's in plain > view. And if you copy that into a mail program it will give the most confusing error ever. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From robin at reportlab.com Wed Jul 29 12:23:52 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 29 Jul 2009 17:23:52 +0100 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A6EA537.4040906@brainbot.com> References: <4A6EA537.4040906@brainbot.com> Message-ID: <4A707798.3040803@chamonix.reportlab.co.uk> Volker Haas wrote: > I believe I just ran into a bug when trying to render some japanese > text. Splitting a paragraph (pagebreak) seems to fail when > > * paragraph.style.wordWrap = 'CJK' > * the paragraph contains mulitple "fragments" (links, images or simple > tags in my example) > > See the attached minimal example. > > Regards, > Volker ..... Volker, I have re-arranged the code in the CJK break lines function and I think it now works in that it allows splitting in the multi-fragment case. I attach a zip containing the modified paragraph.py. Can you try this out? -- Robin Becker -------------- next part -------------- A non-text attachment was scrubbed... Name: newpara.zip Type: application/x-zip-compressed Size: 17038 bytes Desc: not available Url : From eksortso at gmail.com Wed Jul 29 15:49:14 2009 From: eksortso at gmail.com (David Ostroske) Date: Wed, 29 Jul 2009 15:49:14 -0400 Subject: [reportlab-users] Turn off automatic mailto links? In-Reply-To: <200907291036.55363.ralsina@netmanagers.com.ar> References: <200907290940.30417.ralsina@netmanagers.com.ar> <4A704FAA.5050006@chamonix.reportlab.co.uk> <200907291036.55363.ralsina@netmanagers.com.ar> Message-ID: On Wed, Jul 29, 2009 at 9:36 AM, Roberto Alsina wrote: > On Wednesday 29 July 2009 10:33:30 Robin Becker wrote: >> Roberto Alsina wrote: >> > On Wednesday 29 July 2009 07:25:36 Robin Becker wrote: >> >> I'm fairly sure that is being done by the display application rather >> >> than anything we do. I looked at what's produced by your example >> >> >> >> ?> BT 1 0 0 1 0 5.17 Tm /F2 10 Tf 12 TL (example at example.com) Tj T* ET >> >> >> >> so our code isn't doing anything to promote the idea that we want a >> >> link. Even so, acrobat demented reader insists on showing it as a >> >> clickable mailto link. I've tried a few experiments and nothing obvious >> >> seems to do the right thing. It's good to know that the code is working properly. I wasn't sure if the creation of the link was part of the PDF standard or not. I ought to apologize, because I had tried viewing the sample in SumatraPDF, and in that app, the link was not created. But I wasn't sure if SumatraPDF was working right. [...] >> The only problem with the homograph ide is that most fonts won't have one >> easily. I suppose we could modify the encoding to support the right >> behaviour and or embed a single glyph etc etc. >> >> Even if we over come that we then have a document where if we search for >> example at example.com then it wouldn't be found even though it's in plain >> view. > > And if you copy that into a mail program it will give the most confusing error > ever. As far as I'm concerned, the links are irritating but not a deal breaker. Since it's more the fault of Adobe Reader than ReportLab or the PDF format, I wouldn't fuss about implementing a workaround. Matt Folwell suggested turning off link creation; the preference setting is the same in Adobe Reader 9 as it is in version 8. Works like a charm, and I'll recommend it to my coworkers. I'll also recommend SumatraPDF, for many sensible reasons. -- Dave O From mdriscoll at co.marshall.ia.us Thu Jul 30 15:44:09 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Thu, 30 Jul 2009 14:44:09 -0500 Subject: [reportlab-users] Getting Nested table aligned to top Message-ID: <4A71F809.50909@co.marshall.ia.us> Hi, It looks like my post got eaten due to my screenshot, so I have uploaded it to flickr: http://www.flickr.com/photos/25220999 at N03/3773123700/ I am trying to get a set of nested tables to align at the top. There are 6 rows in the screenshot. The first row is 3 "Earnings", the 2nd is the four row table, the 3rd is three "Deductions", the 4th is the 5 row table, etc. Notice that the bottom row has the first two columns lower the the last one. Is there a way to force that row to be aligned at the top? Right now, I use the following code: tblThree = Table(data3, colWidths=colWidths, style=LIST_STYLE, hAlign="LEFT", vAlign="TOP") This does not work. Does anyone have a better idea? I am using Python 2.5 on Windows XP with the latest ReportLab. Thanks, Mike From robin at reportlab.com Fri Jul 31 05:22:21 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 31 Jul 2009 10:22:21 +0100 Subject: [reportlab-users] Getting Nested table aligned to top In-Reply-To: <4A71F809.50909@co.marshall.ia.us> References: <4A71F809.50909@co.marshall.ia.us> Message-ID: <4A72B7CD.3000406@chamonix.reportlab.co.uk> Mike Driscoll wrote: > Hi, > > It looks like my post got eaten due to my screenshot, so I have uploaded > it to flickr: http://www.flickr.com/photos/25220999 at N03/3773123700/ > > I am trying to get a set of nested tables to align at the top. There are > 6 rows in the screenshot. The first row is 3 "Earnings", the 2nd is the > four row table, the 3rd is three "Deductions", the 4th is the 5 row > table, etc. Notice that the bottom row has the first two columns lower > the the last one. Is there a way to force that row to be aligned at the > top? Right now, I use the following code: > > tblThree = Table(data3, colWidths=colWidths, style=LIST_STYLE, > hAlign="LEFT", vAlign="TOP") > > This does not work. Does anyone have a better idea? I am using Python > 2.5 on Windows XP with the latest ReportLab. > > Thanks, > > Mike This single row example shows nested tables aligned right, top. ############################################################### from reportlab.lib import colors from reportlab.platypus.doctemplate import SimpleDocTemplate def getTable(x=0): data=[('','Europe','Asia'), ('Quarter 1',100,200), ('Quarter 2',100,400), ] W=[62,26,26] H=[24,16,16,18] if x: data[3:3] = [('Quarter 3',103,404),('Quarter 4',104,396)] H[3:3] = [16,16] LR = ['Total',300,600] for j in xrange(1,len(LR)): LR[j] = sum([data[i][j] for i in xrange(1,len(data))]) data.append(LR) return Table(data,W,H,style=TableStyle([('GRID', (0,0), (-1,-1), 0.25, colors.black),('FONTSIZE',(0,0),(-1,-1),8)])) T=Table([[getTable(0),getTable(0),getTable(1)]], style=TableStyle([ ('ALIGN', (0,0), (-1,0), 'RIGHT'), ('VALIGN', (0,0), (-1,-1), 'TOP'), ('GRID', (0,0), (-1,-1), 0.25, colors.red), ]), ) SimpleDocTemplate('tnestt.pdf', showBoundary=1).build([T]) ############################################################### -- Robin Becker From wietse.j at gmail.com Fri Jul 31 07:32:01 2009 From: wietse.j at gmail.com (Wietse Jacobs) Date: Fri, 31 Jul 2009 13:32:01 +0200 Subject: [reportlab-users] Filenames on Windows Message-ID: <7d9c65800907310432y20a533edjc5b75d77b4b17611@mail.gmail.com> Hello, We've run into a problem when saving a pdf file with reportlab if the filename contains non-ascii characters. This is on Windows. The problem is with how Python handles the "open(filename)" function on Windows in combination with the fact that reportlab will always encode a unicode string as utf-8: In pdfbase.PDFDocument.SaveToFile the filename that is used to save the file is run through utf8str which will encode any unicode string as utf-8 and for anything else that's passed in it will return str(input). This is obviously "a good thing", except for filenames on Windows. The problem is that on Windows, stock CPython's implementation of 'open()' will use the unicode API of Windows if it's passed in a unicode filename, but the legacy (non-unicode) API if it receives a bytestring. If I run the following script on a Mac, everything looks ok, but on Windows the utf8 names are garbled: -----8<------------------------------------- def try_char(char): name = u'utf8-char_' + char + u'.txt' f = open(name.encode('utf8'), 'wb') f.write('using character "') f.write(char.encode('utf8')) f.write('"\n') f.close() name = u'unicode-char_' + char + u'.txt' f = open(name, 'wb') f.write('using character "') f.write(char.encode('utf8')) f.write('"\n') f.close() for c in ['A', u'\u00E8', u'\u03A0', u'\u03A3', u'\u03A9']: try_char(c) -----8<------------------------------------- If I eliminate the call to utf8str in SaveToFile all works well. Are there reasons to keep this call that I don't see? -- --Wietse From peter at maubp.freeserve.co.uk Fri Jul 31 07:49:00 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Fri, 31 Jul 2009 12:49:00 +0100 Subject: [reportlab-users] Filenames on Windows In-Reply-To: <7d9c65800907310432y20a533edjc5b75d77b4b17611@mail.gmail.com> References: <7d9c65800907310432y20a533edjc5b75d77b4b17611@mail.gmail.com> Message-ID: <320fb6e00907310449u222d787ai7278a0bb253d5785@mail.gmail.com> On Fri, Jul 31, 2009 at 12:32 PM, Wietse Jacobs wrote: > > Hello, > > We've run into a problem when saving a pdf file with reportlab if the > filename contains non-ascii characters. This is on Windows. > > The problem is with how Python handles the "open(filename)" function > on Windows in combination with the fact that reportlab will always > encode a unicode string as utf-8: As a work around, have you tried giving ReportLab a handle, instead of a filename? That way you can control how it is named and opened. Peter From wietse.j at gmail.com Fri Jul 31 08:31:32 2009 From: wietse.j at gmail.com (Wietse Jacobs) Date: Fri, 31 Jul 2009 14:31:32 +0200 Subject: [reportlab-users] Filenames on Windows In-Reply-To: <320fb6e00907310449u222d787ai7278a0bb253d5785@mail.gmail.com> References: <7d9c65800907310432y20a533edjc5b75d77b4b17611@mail.gmail.com> <320fb6e00907310449u222d787ai7278a0bb253d5785@mail.gmail.com> Message-ID: <7d9c65800907310531x226b0eb0i159d9419f7a44b84@mail.gmail.com> 2009/7/31 Peter : > On Fri, Jul 31, 2009 at 12:32 PM, Wietse Jacobs wrote: >> >> Hello, >> >> We've run into a problem when saving a pdf file with reportlab if the >> filename contains non-ascii characters. This is on Windows. >> >> The problem is with how Python handles the "open(filename)" function >> on Windows in combination with the fact that reportlab will always >> encode a unicode string as utf-8: > > As a work around, have you tried giving ReportLab a handle, instead > of a filename? That way you can control how it is named and opened. Thanks for the suggestion, this works without having to change any reportlab code. > Peter -- --Wietse