From robin at reportlab.com Mon Jun 1 04:49:54 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 01 Jun 2009 09:49:54 +0100 Subject: [reportlab-users] Missing Font files In-Reply-To: <4A207EBF.7070505@phitz.au.com> References: <4A207EBF.7070505@phitz.au.com> Message-ID: <4A239632.9030005@chamonix.reportlab.co.uk> John W wrote: > Hi > > Trying to use a script that uses the call renderPM.drawToFile > > but it falls over with > > raise RenderPMError, "Can't setFont(%s) missing the T1 > files?\nOriginally %s > : %s" % (fontName,s1,s2) > reportlab.graphics.renderPM.RenderPMError: Can't setFont(Helvetica) > missing the > T1 files? > Originally : makeT1Font() argument 2 must > be string > , not None > > I've only just installed ReportLab so probably missed something vital > about setting up the fonts. I checked the search path in rl_config.py > but the paths seemed to include directories where my fonts are. > > The call renderPDF.drawToFile works fine > > Can anyone point me to the document that tells me how to set up the > fonts? I feel I've followed all the steps in the userguide for > installation but :-( > > I was going to search the archives of this list but it doesn't look like > that is possible, emails archived in one month blocks and no apparent > search facility; or I'm not looking in the right place. > > Thanks in advance. > > john ......... I think this arises for lack of the base type1 font files. You can get the files here http://www.reportlab.com/ftp/pfbfer.zip just expand the files into your installed reportlab/fonts dir -- Robin Becker From gherman at darwin.in-berlin.de Tue Jun 2 05:26:46 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 2 Jun 2009 11:26:46 +0200 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib Message-ID: Hi, seems like only few people are twittering about ReportLab. Also, ReportLab itself hasn't adopted it, although it might give it a cooler look and help people accept the fact that it's not so open in other areas like bugtracking e.g. (my opinion, if your's is different, that's fine.) Anyway, here's one of the few ReportLab-related tweets to be found, this one on http://twitter.com/dinugherman: Having fun implementing #matplotlib charts as #reportlab flowables (#pdf and #bitmaps) in #python. Very promissing: http://bit.ly/1715G5 Apparently it's even the first using the #reportlab hashtag! Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.king at motorola.com Tue Jun 2 07:55:29 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Tue, 2 Jun 2009 12:55:29 +0100 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: Message-ID: <8D20BBB55F590E42AADF592A815E86170420B881@zuk35exm65.ds.mot.com> Dinu Gherman wrote: > > Anyway, here's one of the few ReportLab-related tweets to be found, > this one on http://twitter.com/dinugherman: > > Having fun implementing #matplotlib charts as #reportlab > flowables (#pdf and #bitmaps) in #python. Very promissing: > http://bit.ly/1715G5 > Hi Dinu, We've also implemented a matplotlib backend that generates ReportLab Flowables. It's not a complete implementation - we stopped when it supported the matplotlib features that we needed. Are you planning on releasing your version? It was always in the back of my mind that we would contribute ours to the matplotlib project, but we haven't got round to it yet. Simon From andy at reportlab.com Tue Jun 2 10:16:55 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 2 Jun 2009 15:16:55 +0100 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: References: Message-ID: <956003ae0906020716v6941d006xe586acb7ec5145ba@mail.gmail.com> 2009/6/2 Dinu Gherman : > Hi, > seems like only few people are twittering about ReportLab. Also, > ReportLab itself hasn't adopted it Twitter is SO last month. We're shooting straight for Google Wave...;-) - Andy From paul.barrass at safeonlinebilling.com Tue Jun 2 10:21:34 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Tue, 02 Jun 2009 15:21:34 +0100 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <956003ae0906020716v6941d006xe586acb7ec5145ba@mail.gmail.com> References: <956003ae0906020716v6941d006xe586acb7ec5145ba@mail.gmail.com> Message-ID: <4A25356E.7020104@safeonlinebilling.com> Andy Robinson wrote: > Twitter is SO last month. We're shooting straight for Google Wave...;-) Thinking it might be out of beta in time for RL3k? ;) Paul Barrass. From janssen at parc.com Tue Jun 2 12:01:00 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 09:01:00 PDT Subject: [reportlab-users] SVG support on the Canvas? Message-ID: <28851.1243958460@parc.com> I'm wondering if there are plans for the Canvas class to grow a "drawSVG" method akin to "drawImage"? Seems like it might be a nice fit. I know about Dinu Gherman's code, but it unfortunately is released under a charming oddball license which IMO makes it pretty much impossible for anyone but hobbyists to use. Bill From andy at reportlab.com Tue Jun 2 12:31:37 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 2 Jun 2009 17:31:37 +0100 Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <28851.1243958460@parc.com> References: <28851.1243958460@parc.com> Message-ID: <956003ae0906020931y78e27895v8359350e63776d49@mail.gmail.com> 2009/6/2 Bill Janssen : > I'm wondering if there are plans for the Canvas class to grow a > "drawSVG" method akin to "drawImage"? ?Seems like it might be a nice fit. No immediate plans among ReportLab's own staff; we have our own (commercial) PDF-importing code which fulfils most of the use cases we have. However, we would welcome any contributions in this area and check them in if the author was happy for us to... 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 timr at probo.com Tue Jun 2 12:43:43 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Jun 2009 09:43:43 -0700 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: References: Message-ID: <4A2556BF.30208@probo.com> Dinu Gherman wrote: > > seems like only few people are twittering about ReportLab. Yes. The rest of us are actually trying to get work done. Honestly, but I fail to see any compelling business advantage at all in devoting resources to "twittering". -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ralsina at netmanagers.com.ar Tue Jun 2 13:08:38 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 02 Jun 2009 14:08:38 -0300 Subject: [reportlab-users] SVG support on the Canvas? References: <28851.1243958460@parc.com> Message-ID: Bill Janssen writes: > I'm wondering if there are plans for the Canvas class to grow a > "drawSVG" method akin to "drawImage"? Seems like it might be a nice fit. > > I know about Dinu Gherman's code, but it unfortunately is released under > a charming oddball license which IMO makes it pretty much impossible for > anyone but hobbyists to use. Have you looked at my uniconvertor-based svg flowable? From janssen at parc.com Tue Jun 2 15:51:30 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 12:51:30 PDT Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: References: <28851.1243958460@parc.com> Message-ID: <34335.1243972290@parc.com> Roberto Alsina wrote: > Bill Janssen writes: > > > I'm wondering if there are plans for the Canvas class to grow a > > "drawSVG" method akin to "drawImage"? Seems like it might be a nice fit. > > > > I know about Dinu Gherman's code, but it unfortunately is released under > > a charming oddball license which IMO makes it pretty much impossible for > > anyone but hobbyists to use. > > Have you looked at my uniconvertor-based svg flowable? No, I don't know about that. Where could I find a copy? Bill From janssen at parc.com Tue Jun 2 15:59:21 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 12:59:21 PDT Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: References: <28851.1243958460@parc.com> Message-ID: <34363.1243972761@parc.com> Roberto Alsina wrote: > Bill Janssen writes: > > > I'm wondering if there are plans for the Canvas class to grow a > > "drawSVG" method akin to "drawImage"? Seems like it might be a nice fit. > > > > I know about Dinu Gherman's code, but it unfortunately is released under > > a charming oddball license which IMO makes it pretty much impossible for > > anyone but hobbyists to use. > > Have you looked at my uniconvertor-based svg flowable? Found it. http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 If I understand what you're doing, you're converting the SVG to PDF, then pasting that PDF inline in the document that ReportLab is generating. Bill From timr at probo.com Tue Jun 2 16:50:54 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 02 Jun 2009 13:50:54 -0700 Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <34363.1243972761@parc.com> References: <28851.1243958460@parc.com> <34363.1243972761@parc.com> Message-ID: <4A2590AE.4000504@probo.com> Bill Janssen wrote: > Found it. http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > If I understand what you're doing, you're converting the SVG to PDF, > then pasting that PDF inline in the document that ReportLab is > generating. > Right. That's what you HAVE to do. The Acrobat readers don't understand embedded SVG (yet). -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From janssen at parc.com Tue Jun 2 17:19:16 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 14:19:16 PDT Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <4A2590AE.4000504@probo.com> References: <28851.1243958460@parc.com> <34363.1243972761@parc.com> <4A2590AE.4000504@probo.com> Message-ID: <36732.1243977556@parc.com> Tim Roberts wrote: > Bill Janssen wrote: > > Found it. http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > > > If I understand what you're doing, you're converting the SVG to PDF, > > then pasting that PDF inline in the document that ReportLab is > > generating. > > > > Right. That's what you HAVE to do. The Acrobat readers don't > understand embedded SVG (yet). Sure, but there's an intermediate stage, an SVG interpreter as part of ReportLab that walks the parsed SVG and re-expresses it in terms of RL vector drawing calls, which of course then get turned into PDF. The problem with embedding "raw" PDF is that it doesn't always work. Bill From ralsina at netmanagers.com.ar Tue Jun 2 17:50:48 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 2 Jun 2009 18:50:48 -0300 Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <34363.1243972761@parc.com> References: <28851.1243958460@parc.com> <34363.1243972761@parc.com> Message-ID: <200906021850.48766.ralsina@netmanagers.com.ar> On Tuesday 02 June 2009 16:59:21 Bill Janssen wrote: > Roberto Alsina wrote: > > Bill Janssen writes: > > > I'm wondering if there are plans for the Canvas class to grow a > > > "drawSVG" method akin to "drawImage"? Seems like it might be a nice > > > fit. > > > > > > I know about Dinu Gherman's code, but it unfortunately is released > > > under a charming oddball license which IMO makes it pretty much > > > impossible for anyone but hobbyists to use. > > > > Have you looked at my uniconvertor-based svg flowable? > > Found it. http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > If I understand what you're doing, you're converting the SVG to PDF, > then pasting that PDF inline in the document that ReportLab is > generating. No, actually the PDF file it generates is a side effect, I am passing the uniconvertor code a canvas and the SVG gets drawn in it after it's parsed. It's completely broken for SVGs that have text in them, 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) "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 ralsina at netmanagers.com.ar Tue Jun 2 17:56:13 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 2 Jun 2009 18:56:13 -0300 Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <36732.1243977556@parc.com> References: <28851.1243958460@parc.com> <4A2590AE.4000504@probo.com> <36732.1243977556@parc.com> Message-ID: <200906021856.13563.ralsina@netmanagers.com.ar> On Tuesday 02 June 2009 18:19:16 Bill Janssen wrote: > Tim Roberts wrote: > > Bill Janssen wrote: > > > Found it. > > > http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > > > > > If I understand what you're doing, you're converting the SVG to PDF, > > > then pasting that PDF inline in the document that ReportLab is > > > generating. > > > > Right. That's what you HAVE to do. The Acrobat readers don't > > understand embedded SVG (yet). > > Sure, but there's an intermediate stage, an SVG interpreter as part of > ReportLab that walks the parsed SVG and re-expresses it in terms of RL > vector drawing calls, which of course then get turned into PDF. The > problem with embedding "raw" PDF is that it doesn't always work. BTW: the latest version is here: http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/svgimage.py http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/uniconvsaver.py The svgimage flowable loads the SVG, which uniconvertor stores in its internal representation. Then the call to save() in drawOn() passes the canvas to the PDFDevice class, which means it just draws the SVG in that canvas, there is never any PDF generated until you save your document. -- ("\''/").__..-''"`-. . 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 janssen at parc.com Tue Jun 2 19:46:00 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 16:46:00 PDT Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <200906021856.13563.ralsina@netmanagers.com.ar> References: <28851.1243958460@parc.com> <4A2590AE.4000504@probo.com> <36732.1243977556@parc.com> <200906021856.13563.ralsina@netmanagers.com.ar> Message-ID: <39434.1243986360@parc.com> What's confusing me is "app". What's that? Bill Roberto Alsina wrote: > On Tuesday 02 June 2009 18:19:16 Bill Janssen wrote: > > Tim Roberts wrote: > > > Bill Janssen wrote: > > > > Found it. > > > > http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > > > > > > > If I understand what you're doing, you're converting the SVG to PDF, > > > > then pasting that PDF inline in the document that ReportLab is > > > > generating. > > > > > > Right. That's what you HAVE to do. The Acrobat readers don't > > > understand embedded SVG (yet). > > > > Sure, but there's an intermediate stage, an SVG interpreter as part of > > ReportLab that walks the parsed SVG and re-expresses it in terms of RL > > vector drawing calls, which of course then get turned into PDF. The > > problem with embedding "raw" PDF is that it doesn't always work. > > BTW: the latest version is here: > > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/svgimage.py > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/uniconvsaver.py > > The svgimage flowable loads the SVG, which uniconvertor stores in its internal > representation. > > Then the call to save() in drawOn() passes the canvas to the PDFDevice class, > which means it just draws the SVG in that canvas, there is never any PDF > generated until you save your document. > > -- > ("\''/").__..-''"`-. . 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From ralsina at netmanagers.com.ar Tue Jun 2 20:22:42 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 2 Jun 2009 21:22:42 -0300 Subject: [reportlab-users] SVG support on the Canvas? In-Reply-To: <39434.1243986360@parc.com> References: <28851.1243958460@parc.com> <200906021856.13563.ralsina@netmanagers.com.ar> <39434.1243986360@parc.com> Message-ID: <200906022122.42711.ralsina@netmanagers.com.ar> On Tuesday 02 June 2009 20:46:00 Bill Janssen wrote: > Bill > Roberto Alsina wrote: > > On Tuesday 02 June 2009 18:19:16 Bill Janssen wrote: > > > Tim Roberts wrote: > > > > Bill Janssen wrote: > > > > > Found it. > > > > > http://lateral.netmanagers.com.ar/weblog/2008/09/10.html#BB753 > > > > > > > > > > If I understand what you're doing, you're converting the SVG to > > > > > PDF, then pasting that PDF inline in the document that ReportLab is > > > > > generating. > > > > > > > > Right. That's what you HAVE to do. The Acrobat readers don't > > > > understand embedded SVG (yet). > > > > > > Sure, but there's an intermediate stage, an SVG interpreter as part of > > > ReportLab that walks the parsed SVG and re-expresses it in terms of RL > > > vector drawing calls, which of course then get turned into PDF. The > > > problem with embedding "raw" PDF is that it doesn't always work. > > > > BTW: the latest version is here: > > > > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/svgimage.py > > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/uniconvsaver > >.py > > > > The svgimage flowable loads the SVG, which uniconvertor stores in its > > internal representation. > > > > Then the call to save() in drawOn() passes the canvas to the PDFDevice > > class, which means it just draws the SVG in that canvas, there is never > > any PDF generated until you save your document. > > What's confusing me is "app". What's that? uniconvertor is not meant to be used as a library. What you see using app is tricking it into working as one. I couldn't tell you exactly what that does anymore :-) -- ("\''/").__..-''"`-. . 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 gherman at darwin.in-berlin.de Wed Jun 3 06:39:21 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 3 Jun 2009 12:39:21 +0200 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420B881@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420B881@zuk35exm65.ds.mot.com> Message-ID: King Simon-NFHD78: > We've also implemented a matplotlib backend that generates ReportLab > Flowables. It's not a complete implementation - we stopped when it > supported the matplotlib features that we needed. Are you planning on > releasing your version? It was always in the back of my mind that we > would contribute ours to the matplotlib project, but we haven't got > round to it yet. Hi Simon, I think writing a Matplotlib backend for RL shapes would be inter- esting only to very few people. And my experience with my own svglib module showed me that RL is missing quite a few interesting features like true shading, to justify such en effort. So I wrote a RL flowable that wraps an aribtrary Matplotlib figure, renders it to PDF or PNG (using Matplotlib) and imports it into a Platypus story. That takes only about 40 lines of code. The really interesting bits are elsewere to import the figure's PDF (if chosen) into the document one using pyPdf. In this process there are some tiny buglets that I'm still chasing. That should provide a feature-complete (Matplotlib-side) solution, but of course I haven't tested all the Matplotlib gallery samples since they are often written for interactive use and need manual changes for batch handling. I did the same using Matplotlib's SVG output and my svglib, which unfortunately revealed a bug in svglib for texts. Apart from that it will not be able to handle shading (although I don't know yet if Matplotlib does actually use that). And the same previous comments on mass testing apply here as well. So much for now... Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Wed Jun 3 14:27:42 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 3 Jun 2009 15:27:42 -0300 Subject: [reportlab-users] Trying to implement "See page X" Message-ID: <200906031527.42546.ralsina@netmanagers.com.ar> And it's almost there, but I am doing something wrong :-) Here's my approach: In some cases, instead of a regular paragraph, create a DelayedParagraph wrapper around Paragraph, which is an IndexingFlowable and gets notified of bookmarks. Then, in DelayedParagraph.notify, "fix" the text by replacing references to bookmarks with the corresponding page numbers. Example: 'Go see A title (Page %(a-title)s)'%{'a-title': 2} And it works like a charm... unless the bookmark is *after* the DelayedParagraph, in which case it just gets drawn before the text is "fixed". I though that by returning False to isSatisfied(), the delayedParagraph would not get drawn, then force another build pass, fix the references, then draw it, but I am obviously mistaking. I can't use onDraw like the table of contents does because I need to put the page number in the paragraph textflow, and that means I can't just "save the space" for it. Sadly since this is in rst2pdf extracting a small example is not trivial, I hope my description is useful... Here is my DelayedParagraph class: http://pastebin.com/f60b5f7e9 -- ("\''/").__..-''"`-. . 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 moshe.wagner at gmail.com Wed Jun 3 17:05:50 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Thu, 4 Jun 2009 00:05:50 +0300 Subject: [reportlab-users] Hebrew Support Patch Message-ID: Hello, While trying to use reportlab with Hebrew text, I noticed Hebrew isn't really supported (The text appears mirrored). In this list's archive I saw a post saying I should use "pyfribidi.log2vis" on my text. That worked for single lines, but it made paragraphs start from the bottom up (as the text really goes from the top left down, flipping it makes it seem like it starts at bottom right going up). So I've added, (to reportlab_2_3), a few lines to 'paragraph.py', making it visualise every line after the text has been split up, rather than doing that before. It seemed to work well, besides a minor issue that when full_justified, the last line of text is on the left, which is what should happen for LTR text, but not for RTL. The code is ignored if pyfribidi isn't installed, but anyway, it shouldn't affect any LTR text. I'm not a great programmer, and neither do I know python or reportlab very well, so I can't promise the code is so great, or that it covers all cases. Anyway, here's what I added: -> In "paragraph.h", in the "wrap" function, right after calling "self.breakLine": ( the code I ad was version 2_3): ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by joining all the words of each line, flips them with pyfribidi #(if needed), then splits them again, and re enters them to the paragraph's text #If fribidi cant be imported, it does nothing try: import pyfribidi for i in range(len(blPara.lines)): s = "" for j in range(len(blPara.lines[i][1])): #print self.blPara.lines[i][1][j] s = s + self.blPara.lines[i][1][j] + " " while len(blPara.lines[i][1]) > 0: self.blPara.lines[i][1].pop(0) s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) splits = s.split() #print splits for j in range(len(splits)): self.blPara.lines[i][1].append(splits[j]) #print self.blPara.lines[i][1][1:] except ImportError: print "Fribidi module not found; You will not have rtl support for this paragraph" ###################### -> And in "canvas.py", in the "drawString" function, right at it's begining: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) # If it could not be imported, it does nothing try: import pyfribidi text = pyfribidi.log2vis(text, base_direction = pyfribidi.ON) except ImportError: print "Fribidi module not found; You will not have rtl support for this line" ##################### I'd be very glad if you could merge this into the code, no need to keep any reference to me. Thanks, Moshe From robin at reportlab.com Thu Jun 4 05:15:07 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 04 Jun 2009 10:15:07 +0100 Subject: [reportlab-users] Trying to implement "See page X" In-Reply-To: <200906031527.42546.ralsina@netmanagers.com.ar> References: <200906031527.42546.ralsina@netmanagers.com.ar> Message-ID: <4A27909B.6010408@chamonix.reportlab.co.uk> Roberto Alsina wrote: > And it's almost there, but I am doing something wrong :-) > > Here's my approach: In some cases, instead of a regular paragraph, create a > DelayedParagraph wrapper around Paragraph, which is an IndexingFlowable and > gets notified of bookmarks. > > Then, in DelayedParagraph.notify, "fix" the text by replacing references to > bookmarks with the corresponding page numbers. > > Example: > > 'Go see A title (Page %(a-title)s)'%{'a-title': 2} > > And it works like a charm... unless the bookmark is *after* the > DelayedParagraph, in which case it just gets drawn before the text is "fixed". > > I though that by returning False to isSatisfied(), the delayedParagraph would > not get drawn, then force another build pass, fix the references, then draw > it, but I am obviously mistaking. > > I can't use onDraw like the table of contents does because I need to put the > page number in the paragraph textflow, and that means I can't just "save the > space" for it. > > Sadly since this is in rst2pdf extracting a small example is not trivial, I > hope my description is useful... > > Here is my DelayedParagraph class: > > http://pastebin.com/f60b5f7e9 > In general there's no obvious way to do both forward and backward links single pass However, it should be possible to do this with multi-pass without any delay at all. What's required is that the variables that are being referenced in the draw method have stabilized. Are you using multibuild? -- Robin Becker From robin at reportlab.com Thu Jun 4 06:42:54 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 04 Jun 2009 11:42:54 +0100 Subject: [reportlab-users] Trying to implement "See page X" In-Reply-To: <200906031527.42546.ralsina@netmanagers.com.ar> References: <200906031527.42546.ralsina@netmanagers.com.ar> Message-ID: <4A27A52E.6060606@chamonix.reportlab.co.uk> Looking a bit further into the multibuild stuff it seems that it is fairly broken. Firstly the concept of an indexing flowable is weakly implemented as it will fail (as currently implemented) if we put the indexable inside a container of some sort eg a table. As I understand it a pass should be regarded as not happy if anything that gets rendered has a reference to an undefined variable. Mostly these variables would be section, chapter etc numbers and page numbers or positions (ie bookmarks). It ought to be perfectly feasible to define a simple way to record variables as they are defined so that references to them can easily check which ones are unsatisfied. The chapter/section/page numbers etc are a document level issue, but the positional references require some cooperation at the canvas/pdfdoc layer. -- Robin Becker From ralsina at netmanagers.com.ar Thu Jun 4 08:13:03 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 4 Jun 2009 09:13:03 -0300 Subject: [reportlab-users] Trying to implement "See page X" In-Reply-To: <4A27909B.6010408@chamonix.reportlab.co.uk> References: <200906031527.42546.ralsina@netmanagers.com.ar> <4A27909B.6010408@chamonix.reportlab.co.uk> Message-ID: <200906040913.04213.ralsina@netmanagers.com.ar> On Thursday 04 June 2009 06:15:07 Robin Becker wrote: > Roberto Alsina wrote: > > And it's almost there, but I am doing something wrong :-) > > > > Here's my approach: In some cases, instead of a regular paragraph, create > > a DelayedParagraph wrapper around Paragraph, which is an IndexingFlowable > > and gets notified of bookmarks. > > > > Then, in DelayedParagraph.notify, "fix" the text by replacing references > > to bookmarks with the corresponding page numbers. > > > > Example: > > > > 'Go see A title (Page %(a-title)s)'%{'a-title': 2} > > > > And it works like a charm... unless the bookmark is *after* the > > DelayedParagraph, in which case it just gets drawn before the text is > > "fixed". > > > > I though that by returning False to isSatisfied(), the delayedParagraph > > would not get drawn, then force another build pass, fix the references, > > then draw it, but I am obviously mistaking. > > > > I can't use onDraw like the table of contents does because I need to put > > the page number in the paragraph textflow, and that means I can't just > > "save the space" for it. > > > > Sadly since this is in rst2pdf extracting a small example is not trivial, > > I hope my description is useful... > > > > Here is my DelayedParagraph class: > > > > http://pastebin.com/f60b5f7e9 > > In general there's no obvious way to do both forward and backward links > single pass > > However, it should be possible to do this with multi-pass without any delay > at all. What's required is that the variables that are being referenced in > the draw method have stabilized. Are you using multibuild? Yes. However the first "see page X" that is before the definition of the bookmark gets its draw() called in the first pass, even though it's marked as not satisfied. -- ("\''/").__..-''"`-. . 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 ralsina at netmanagers.com.ar Thu Jun 4 08:14:41 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 4 Jun 2009 09:14:41 -0300 Subject: [reportlab-users] Trying to implement "See page X" In-Reply-To: <4A27A52E.6060606@chamonix.reportlab.co.uk> References: <200906031527.42546.ralsina@netmanagers.com.ar> <4A27A52E.6060606@chamonix.reportlab.co.uk> Message-ID: <200906040914.41645.ralsina@netmanagers.com.ar> On Thursday 04 June 2009 07:42:54 Robin Becker wrote: > Looking a bit further into the multibuild stuff it seems that it is fairly > broken. > > Firstly the concept of an indexing flowable is weakly implemented as it > will fail (as currently implemented) if we put the indexable inside a > container of some sort eg a table. > > As I understand it a pass should be regarded as not happy if anything that > gets rendered has a reference to an undefined variable. Mostly these > variables would be section, chapter etc numbers and page numbers or > positions (ie bookmarks). It ought to be perfectly feasible to define a > simple way to record variables as they are defined so that references to > them can easily check which ones are unsatisfied. > > The chapter/section/page numbers etc are a document level issue, but the > positional references require some cooperation at the canvas/pdfdoc layer. I managed to make this work with a sort of multi-multi-build but I broke images. I will try to experiment a bit more and see if I can make xamples of this in reportlab code so others can follow it. -- ("\''/").__..-''"`-. . 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 ralsina at netmanagers.com.ar Thu Jun 4 08:54:22 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 4 Jun 2009 09:54:22 -0300 Subject: [reportlab-users] Simple multibuild doesn't work Message-ID: <200906040954.22789.ralsina@netmanagers.com.ar> What's wrong with this simple program? Here is the code, which is basically the example from the docs, simplified, and changed from build to multiBuild: http://pastebin.com/f5ecf1e1f Tried it with reportlab 2.3 and r3492 from svn. If I use build() it works, with multiBuild() it fails with this exception: File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 874, in multiBuild self.build(tempStory, filename, canvasmaker) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 1029, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 793, in build self.clean_hanging() File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 428, in clean_hanging self.handle_flowable(self._hanging) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 675, in handle_flowable f.apply(self) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 132, in apply getattr(doc,arn)(*args) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 1005, in handle_pageBegin self._handle_pageBegin() File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 453, in handle_pageBegin self.pageTemplate.onPage(self.canv,self) TypeError: 'NoneType' object is not callable -- ("\''/").__..-''"`-. . 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 robin at reportlab.com Thu Jun 4 09:09:02 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 04 Jun 2009 14:09:02 +0100 Subject: [reportlab-users] Simple multibuild doesn't work In-Reply-To: <200906040954.22789.ralsina@netmanagers.com.ar> References: <200906040954.22789.ralsina@netmanagers.com.ar> Message-ID: <4A27C76E.1070100@chamonix.reportlab.co.uk> Roberto Alsina wrote: > What's wrong with this simple program? > > Here is the code, which is basically the example from the docs, simplified, > and changed from build to multiBuild: > > http://pastebin.com/f5ecf1e1f > > Tried it with reportlab 2.3 and r3492 from svn. > > If I use build() it works, with multiBuild() it fails with this exception: > > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 874, in multiBuild > self.build(tempStory, filename, canvasmaker) > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 1029, in build > BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 793, in build > self.clean_hanging() > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 428, in clean_hanging > self.handle_flowable(self._hanging) > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 675, in handle_flowable > f.apply(self) > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 132, in apply > getattr(doc,arn)(*args) > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 1005, in handle_pageBegin > self._handle_pageBegin() > File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", > line 453, in handle_pageBegin > self.pageTemplate.onPage(self.canv,self) > TypeError: 'NoneType' object is not callable > > > I suspect that multibuild actually requires some Indexing flowables to work. -- Robin Becker From ralsina at netmanagers.com.ar Thu Jun 4 09:28:36 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 4 Jun 2009 10:28:36 -0300 Subject: [reportlab-users] Simple multibuild doesn't work In-Reply-To: <4A27C76E.1070100@chamonix.reportlab.co.uk> References: <200906040954.22789.ralsina@netmanagers.com.ar> <4A27C76E.1070100@chamonix.reportlab.co.uk> Message-ID: <200906041028.37418.ralsina@netmanagers.com.ar> On Thursday 04 June 2009 10:09:02 Robin Becker wrote: > Roberto Alsina wrote: > > What's wrong with this simple program? > > > > Here is the code, which is basically the example from the docs, > > simplified, and changed from build to multiBuild: > > > > http://pastebin.com/f5ecf1e1f > > > > Tried it with reportlab 2.3 and r3492 from svn. > > > > If I use build() it works, with multiBuild() it fails with this > > exception: > > I suspect that multibuild actually requires some Indexing flowables to > work. If I add a TableOfContents it fails in the exact same way. http://pastebin.com/f3e11f1d8 Maybe what it needs is a bookmark? Sorry if this is an unrealistic example. -- ("\''/").__..-''"`-. . 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 robin at reportlab.com Thu Jun 4 12:06:25 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 04 Jun 2009 17:06:25 +0100 Subject: [reportlab-users] Simple multibuild doesn't work In-Reply-To: <200906041028.37418.ralsina@netmanagers.com.ar> References: <200906040954.22789.ralsina@netmanagers.com.ar> <4A27C76E.1070100@chamonix.reportlab.co.uk> <200906041028.37418.ralsina@netmanagers.com.ar> Message-ID: <4A27F101.7070400@chamonix.reportlab.co.uk> Roberto Alsina wrote: > On Thursday 04 June 2009 10:09:02 Robin Becker wrote: >> Roberto Alsina wrote: >>> What's wrong with this simple program? >>> >>> Here is the code, which is basically the example from the docs, >>> simplified, and changed from build to multiBuild: >>> >>> http://pastebin.com/f5ecf1e1f >>> >>> Tried it with reportlab 2.3 and r3492 from svn. >>> >>> If I use build() it works, with multiBuild() it fails with this >>> exception: >> I suspect that multibuild actually requires some Indexing flowables to >> work. > > If I add a TableOfContents it fails in the exact same way. > > http://pastebin.com/f3e11f1d8 > > Maybe what it needs is a bookmark? > > Sorry if this is an unrealistic example. > The onPage thing is a property of the document/template classes so the implication is that something is not setting up properly. I haven't used multi-build very much so cannot really say. The onPage stuff is supposed to be set up by SimpleDocTemplate. I figured out that whoever added multiBuild did it only for the base class. The build call in there is incompatible with the SimpleDocTemplate. I guess really that whoever wrote build (that's me) was stupid in allowing build to have any arguments other than the story. Anyhow I can make multibuild compatible by making its signature look like this def multiBuild(self, story, maxPasses = 10, **buildKwds ): then in the body of multiBuild the call to build looks like this self.build(tempStory, **buildKwds) that at least allows stuff to proceed. -- Robin Becker From moshe.wagner at gmail.com Thu Jun 4 16:07:39 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Thu, 4 Jun 2009 23:07:39 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: Message-ID: After using the code I've written some more, I found a few bugs. So this should be the code for - paragraph.h, in the 'wrap' function: Still isn't written so well, but should work better: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line seperatly. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing try: import pyfribidi for i in range(len(blPara.lines)): if blPara.lines[i].__class__.__name__ == FragLine.__name__ \ or blPara.lines[i].__class__.__name__ == ParaLines.__name__: for j in range(len(blPara.lines[i].words)): """When the line is a FragLine or ParaLines, It's text attribute is flipped. Then, the order of the words is flipped too, So that 2 word parts on the same line will be in the right order """ s = blPara.lines[i].words[j].text s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) blPara.lines[i].words[j].text = s if len(blPara.lines[i].words) % 2 == 0: half = int(len(blPara.lines[i].words)/2) else: half = int((len(blPara.lines[i].words)+1)/2) for j in range(half): t = blPara.lines[i].words[j] blPara.lines[i].words[j] = blPara.lines[i].words[len(blPara.lines[i].words)-j-1] blPara.lines[i].words[len(blPara.lines[i].words)-j-1] = t elif type(blPara.lines[i]).__name__ == 'tuple': """When the line is just a tuple whose second value is the text, since I coulden't directly change it's value, it's done by merging the words, flipping them, and re-entering them one by one to the second attribute """ s = "" for j in range(len(blPara.lines[i][1])): s = s + self.blPara.lines[i][1][j] + " " while len(blPara.lines[i][1]) > 0: self.blPara.lines[i][1].pop(0) s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) splits = s.split() #print splits for j in range(len(splits)): self.blPara.lines[i][1].append(splits[j]) else: print blPara.lines[i].__class__.__name__ #print self.blPara.lines[i][1][1:] except ImportError: print "Fribidi module not found; You will not have rtl support for this paragraph" ###################### On Thu, Jun 4, 2009 at 12:05 AM, Moshe Wagner wrote: > Hello, > > While trying to use reportlab with Hebrew text, I noticed Hebrew isn't > really supported (The text appears mirrored). > > In this list's archive I saw a post saying I should use > "pyfribidi.log2vis" on my text. > > That worked for single lines, but it made paragraphs start from the > bottom up (as the text really goes from the top left down, flipping it > makes it seem like it starts at bottom right going up). > > > So I've added, (to reportlab_2_3), ?a few lines to 'paragraph.py', > making it visualise every line after the text has been split up, > rather than doing that before. > It seemed to work well, besides a minor issue that when > full_justified, ?the last line of text is on the left, which is what > should happen for LTR text, but not for RTL. > > The code is ignored if pyfribidi isn't installed, but anyway, it > shouldn't affect any LTR text. > > I'm not a great programmer, and neither do I know python or reportlab > very well, so I can't promise the code is so great, or that it covers > all cases. > > Anyway, here's what I added: > > -> In "paragraph.h", in the "wrap" function, right after calling > "self.breakLine": > ( the code I ad was version 2_3): > > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > > #This code fixes paragraphs with RTL text > > # It does it by joining all the words of each line, flips them with pyfribidi > #(if needed), then splits them again, and re enters them to the paragraph's text > > #If fribidi cant be imported, it does nothing > > try: > ? ? ? ?import pyfribidi > > ? ? ? ?for i in range(len(blPara.lines)): > ? ? ? ? ? ? ? ?s = "" > ? ? ? ? ? ? ? ?for j in range(len(blPara.lines[i][1])): > ? ? ? ? ? ? ? ? ? ? ? ?#print self.blPara.lines[i][1][j] > ? ? ? ? ? ? ? ? ? ? ? ?s = s + self.blPara.lines[i][1][j] + " " > > ? ? ? ? ? ? ? ?while len(blPara.lines[i][1]) > 0: > ? ? ? ? ? ? ? ? ? ? ? ?self.blPara.lines[i][1].pop(0) > > ? ? ? ? ? ? ? ?s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) > ? ? ? ? ? ? ? ?splits = s.split() > > ? ? ? ? ? ? ? ?#print splits > > ? ? ? ? ? ? ? ?for j in range(len(splits)): > ? ? ? ? ? ? ? ? ? ? ? ?self.blPara.lines[i][1].append(splits[j]) > ? ? ? ? ? ? ? ?#print self.blPara.lines[i][1][1:] > except ImportError: > ? ? ? ?print "Fribidi module not found; You will not have rtl support for > this paragraph" > ###################### > > > -> And in "canvas.py", in the "drawString" function, right at it's begining: > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) > # If it could not be imported, it does nothing > try: > ? ? ? ?import pyfribidi > > ? ? ? ?text = pyfribidi.log2vis(text, base_direction = pyfribidi.ON) > > except ImportError: > ? ? ? ?print "Fribidi module not found; You will not have rtl support for this line" > ##################### > > > I'd be very glad if you could merge this into the code, no need to > keep any reference to me. > > Thanks, > Moshe > From timr at probo.com Thu Jun 4 16:36:57 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 04 Jun 2009 13:36:57 -0700 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: Message-ID: <4A283069.5070902@probo.com> Moshe Wagner wrote: > After using the code I've written some more, I found a few bugs. > So this should be the code for - paragraph.h, in the 'wrap' function: > > Still isn't written so well, but should work better: > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > > #This code fixes paragraphs with RTL text > > # It does it by flipping each line seperatly. > # (Depending on the type of the line) > > # If fribidi cant be imported, it does nothing > > try: > import pyfribidi > > for i in range(len(blPara.lines)): > if blPara.lines[i].__class__.__name__ == FragLine.__name__ \ > or blPara.lines[i].__class__.__name__ == ParaLines.__name__: > for j in range(len(blPara.lines[i].words)): > """When the line is a FragLine or ParaLines, It's > text attribute is flipped. > Then, the order of the words is flipped too, > So that 2 word parts on the same line > will be in the right order """ > > s = blPara.lines[i].words[j].text > s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) > blPara.lines[i].words[j].text = s > Much of this can by simplified, and made easier to read (and a bit more efficient) by using a style this: try: import pyfribidi for line in blPara.lines: if type(line) in (FragLine, ParaLines): for word in line.words: s = pyfribidi.log2vis( word.text, base_direction=pyfribidi.ON) word.text = s ... elif type(line) == tuple: s = ' '.join(line[1]) s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) line[1][:] = s.split() else: print type(line) Almost any time you have "for i in range(line(k))", you should think about it as "for i in k" instead. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From moshe.wagner at gmail.com Fri Jun 5 03:02:57 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Fri, 5 Jun 2009 10:02:57 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <4A283069.5070902@probo.com> References: <4A283069.5070902@probo.com> Message-ID: Thanks for your corrections. As I said, I'm new to python, so I didn't realize you could use loops that way. This line: "if type(line) in (FragLine, ParaLines):" didn't seem to work, as type(line) always returned "instance", so I kept it the way I had it. Another thing I did wrong is implementing '.reverse()' manually, not realizing it exists. So here's the new code. Clearly looks better: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line seperatly. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing try: import pyfribidi for line in blPara.lines: if line.__class__.__name__ in ('FragLine', 'ParaLines'): """When the line is a FragLine or ParaLines, It's text attribute of each of it's words is flipped. Then, the order of the words is flipped too, So that 2 word parts on the same line will be in the right order """ for word in line.words: word.text = pyfribidi.log2vis (word.text, base_direction = pyfribidi.ON) line.words.reverse() elif line.__class__.__name__ == 'tuple': """When the line is just a tuple whose second value is the text. since I coulden't directly change it's value, it's done by merging the words, flipping them, and re-entering them one by one to the second attribute """ s = ' '.join(line[1]) s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) line[1][:] = s.split() else: print line.__class__.__name__ #print self.blPara.lines[i][1][1:] except ImportError: print "Fribidi module not found; You will not have rtl support for this paragraph" ###################### Is there any chance this could be added to the official code? Moshe On Thu, Jun 4, 2009 at 11:36 PM, Tim Roberts wrote: > Moshe Wagner wrote: >> After using the code I've written some more, I found a few bugs. >> So this should be the code for - paragraph.h, in the 'wrap' function: >> >> Still isn't written so well, but should work better: >> ###################### >> # Hebrew text patch, Moshe Wagner, June 2009 >> # >> >> >> #This code fixes paragraphs with RTL text >> >> # It does it by flipping each line seperatly. >> # ? ? (Depending on the type of the line) >> >> # If fribidi cant be imported, it does nothing >> >> try: >> ? ? ? import pyfribidi >> >> ? ? ? for i in range(len(blPara.lines)): >> ? ? ? ? ? ? ? if blPara.lines[i].__class__.__name__ == FragLine.__name__ \ >> ? ? ? ? ? ? ? or blPara.lines[i].__class__.__name__ == ParaLines.__name__: >> ? ? ? ? ? ? ? ? ? ? ? for j in range(len(blPara.lines[i].words)): >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? """When the line is a FragLine or ParaLines, It's >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? text attribute is flipped. >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Then, the order of the words is flipped too, >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? So that 2 word parts on the same line >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? will be in the right order """ >> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s = blPara.lines[i].words[j].text >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? s = pyfribidi.log2vis (s, base_direction = pyfribidi.ON) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? blPara.lines[i].words[j].text = s >> > > Much of this can by simplified, and made easier to read (and a bit more > efficient) by using a style this: > > ? ?try: > ? ? ? ?import pyfribidi > ? ? ? ?for line in blPara.lines: > ? ? ? ? ? ?if type(line) in (FragLine, ParaLines): > ? ? ? ? ? ? ? ?for word in line.words: > ? ? ? ? ? ? ? ? ? ?s = pyfribidi.log2vis( word.text, > base_direction=pyfribidi.ON) > ? ? ? ? ? ? ? ? ? ?word.text = s > ? ? ? ? ? ? ? ?... > ? ? ? ? ? ?elif type(line) == tuple: > ? ? ? ? ? ? ? ?s = ' '.join(line[1]) > ? ? ? ? ? ? ? ?s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) > ? ? ? ? ? ? ? ?line[1][:] = s.split() > ? ? ? ? ? ?else: > ? ? ? ? ? ? ? ?print type(line) > > Almost any time you have "for i in range(line(k))", you should think > about it as "for i in k" instead. > > -- > 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 jon at phitz.au.com Fri Jun 5 05:51:35 2009 From: jon at phitz.au.com (John W) Date: Fri, 05 Jun 2009 19:51:35 +1000 Subject: [reportlab-users] Missing Font files In-Reply-To: <4A210DFF.8050109@safeonlinebilling.com> References: <4A210DFF.8050109@safeonlinebilling.com> Message-ID: <4A28EAA7.1070407@phitz.au.com> Paul wrote: > RenderPM is an optional dependency for RL, which itself requires > FreeType2 - during install the script should announce if it has been > found or not. You'll need to install FreeType2 (and the -devel) and > reinstall RL. Without more details on your environment I can't be more > specific, though if you're on a Mac, the posts of the last couple of > days should be very useful as it's been fully detailed. Yup that did the trick thanks very much for the help. > As with all such things Google Is Your Friend [i.e. > "site:two.pairlist.net reportlab install"]. Someone, in the last couple > of months, posted a specialised search provider for mailing lists - > though without a searchable archive it'll be hard to find.... Works too :-) Hopefully I can get this working as I'd like without asking that same newbie question again.... Again thanks for the help Paul. Regards john No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.53/2155 - Release Date: 06/04/09 17:55:00 From marius at gedmin.as Fri Jun 5 08:54:24 2009 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 5 Jun 2009 15:54:24 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> Message-ID: <20090605125424.GB9529@platonas> On Fri, Jun 05, 2009 at 10:02:57AM +0300, Moshe Wagner wrote: > Thanks for your corrections. > As I said, I'm new to python, so I didn't realize you could use loops > that way. Welcome. I think you'll enjoy Python. I do. > This line: > "if type(line) in (FragLine, ParaLines):" > didn't seem to work, as type(line) always returned "instance", so I > kept it the way I had it. Old-style classes FTW. isinstance(line, (FragLine, ParaLines)) should work, and is better style anyway. > Another thing I did wrong is implementing '.reverse()' manually, not > realizing it exists. > > So here's the new code. Clearly looks better: > > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > #This code fixes paragraphs with RTL text > > # It does it by flipping each line seperatly. > # (Depending on the type of the line) > > # If fribidi cant be imported, it does nothing > > try: > import pyfribidi Please don't use tabs for indentation. 4 spaces are traditional. (The Python coding style guidelines are almost universally accepted; you can find them at http://www.python.org/dev/peps/pep-0008/) Although last time I checked Reportlab didn't follow PEP-8 faithfully. > for line in blPara.lines: > if line.__class__.__name__ in ('FragLine', 'ParaLines'): isinstance(line, (FragLine, ParaLines)) > """When the line is a FragLine or ParaLines, It's > text attribute of each of it's words is flipped. > Then, the order of the words is flipped too, > So that 2 word parts on the same line > will be in the right order """ Comments are written like this: # When the line is a FragLine or ParaLines, It's # text attribute of each of it's words is flipped. # Then, the order of the words is flipped too, # So that 2 word parts on the same line # will be in the right order Also, it's "its", not "It's". > for word in line.words: > word.text = pyfribidi.log2vis (word.text, base_direction = pyfribidi.ON) PEP-8 recommends no space in front of ( following a function name, and no spaces around = when used to pass keyword arguments. > > line.words.reverse() > > elif line.__class__.__name__ == 'tuple': isinstance(line, tuple) > """When the line is just a tuple whose second value is the text. > since I coulden't directly change it's value, > it's done by merging the words, flipping them, > and re-entering them one by one to the second attribute """ > > s = ' '.join(line[1]) > s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) > line[1][:] = s.split() > else: > print line.__class__.__name__ This is for debugging purposes, right? > #print self.blPara.lines[i][1][1:] > except ImportError: > print "Fribidi module not found; You will not have rtl support for > this paragraph" It's typically better to keep the part between try: and except: as small as possible, thus it's idiomatic to write try: import pyfribidi except ImportError: print >> sys.stderr, "Fribidi module not found ..." else: # code Printing to sys.stdout (or even sys.stderr) from a library is perhaps bad style, but I'm not sure what's the right solution here. Either the logging or the warnings module would be better. E.g. try: import pyfribidi except ImportError: warnings.warn("Fribidi module not found ...") else: # code > ###################### > > Is there any chance this could be added to the official code? I'm not affiliated with Reportlab in any way (other than being a happy user and a some-time contributor a long time ago), but I'd say yes. The chances would be better if you added some tests for the new code. Marius Gedminas -- We have enough youth, how about a fountain of SMART? -------------- 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 Fri Jun 5 09:37:33 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 5 Jun 2009 14:37:33 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> Message-ID: <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> 2009/6/5 Moshe Wagner : > Is there any chance this could be added to the official code? Moshe, thanks very much for your contribution. We're happy in principle to add this kind of patch but it would help a great deal if you could produce two more things... (a) a suitable few paragraphs for us to put in a Whats New page or the user guide. Mention what pyfribidi is, what version is needed (if it matters) and where to get it. Also mention what one needs to install to view these things - do we need special fonts, Acrobat Language packs etc..? Assume the reader knows nothing about RTL. Just send text to me or the list and I'll add it to the docs and/or web site. (b) most important of all, a small test script (see our 'tests' folder) which generates some Hebrew and/or Arabic output, which we can run and look at. The absolute ideal test script would have a bitmap of the correct Hebrew to look at, and say "the text below should look like the above", since I at least would not know if it was backwards or forwards ;-) Most people in ReportLab are too busy to have been following this in detail but we'd really welcome any improvement in this area. We are also starting from zero knowledge of Hebrew and Arabic - unlike Asian text which we deal with daily. There will be a release in a few weeks and this would be a very valuable addition... 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 timr at probo.com Fri Jun 5 13:06:01 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 05 Jun 2009 10:06:01 -0700 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <20090605125424.GB9529@platonas> References: <4A283069.5070902@probo.com> <20090605125424.GB9529@platonas> Message-ID: <4A295079.3090500@probo.com> Marius Gedminas wrote: > Old-style classes FTW. > > isinstance(line, (FragLine, ParaLines)) should work, and is better style > anyway. > Thank you for this. I knew the concept, but brain didn't come up with the right syntax and I was too lazy to confirm it. This solution has the added benefit that it will work for classes that DERIVE from FragLine and ParaLines, something that the "__class__.__name__ in ('xxx','yyy')" solution does not. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ralsina at netmanagers.com.ar Fri Jun 5 14:16:48 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 5 Jun 2009 15:16:48 -0300 Subject: [reportlab-users] Using PDF as an image in a ReportLab document Message-ID: <200906051516.49124.ralsina@netmanagers.com.ar> This is caused by an issue reported about rst2pdf: http://code.google.com/p/rst2pdf/issues/detail?id=127 Basically: is there a way to use a PDF file like we use a PNG file, to do an Image or Image-like flowable? Best regards, -- ("\''/").__..-''"`-. . 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 moshe.wagner at gmail.com Sun Jun 7 05:32:19 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Sun, 7 Jun 2009 12:32:19 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <20090605125424.GB9529@platonas> References: <4A283069.5070902@probo.com> <20090605125424.GB9529@platonas> Message-ID: Thanks for all your comments. I'm starting to like python too, although I'm still overwhelmed by the fact that the same variable could be of different types without any warning. Besides "warnings.warn" that didn't seem to work (or did I misunderstand you?), I tried to follow your suggestions. I'll post the new code in my reply to Andy's email. Thanks again, Moshe On Fri, Jun 5, 2009 at 3:54 PM, Marius Gedminas wrote: > On Fri, Jun 05, 2009 at 10:02:57AM +0300, Moshe Wagner wrote: >> Thanks for your corrections. >> As I said, I'm new to python, so I didn't realize you could use loops >> that way. > > Welcome. ?I think you'll enjoy Python. ?I do. > >> This line: >> "if type(line) in (FragLine, ParaLines):" >> ?didn't seem to work, as type(line) always returned "instance", so I >> kept it the way I had it. > > Old-style classes FTW. > > isinstance(line, (FragLine, ParaLines)) should work, and is better style > anyway. > >> Another thing I did wrong is implementing '.reverse()' manually, not >> realizing it exists. >> >> So here's the new code. Clearly looks better: >> >> ###################### >> # Hebrew text patch, Moshe Wagner, June 2009 >> # >> >> #This code fixes paragraphs with RTL text >> >> # It does it by flipping each line seperatly. >> # ? ? (Depending on the type of the line) >> >> # If fribidi cant be imported, it does nothing >> >> try: >> ? ? ? import pyfribidi > > Please don't use tabs for indentation. ?4 spaces are traditional. ?(The > Python coding style guidelines are almost universally accepted; you can > find them at http://www.python.org/dev/peps/pep-0008/) > > Although last time I checked Reportlab didn't follow PEP-8 faithfully. > >> ? ? ? for line in blPara.lines: >> ? ? ? ? ? ? ? if line.__class__.__name__ in ('FragLine', 'ParaLines'): > > isinstance(line, (FragLine, ParaLines)) > >> ? ? ? ? ? ? ? ? ? ? ? """When the line is a FragLine or ParaLines, It's >> ? ? ? ? ? ? ? ? ? ? ? text attribute of each of it's words is flipped. >> ? ? ? ? ? ? ? ? ? ? ? Then, the order of the words is flipped too, >> ? ? ? ? ? ? ? ? ? ? ? So that 2 word parts on the same line >> ? ? ? ? ? ? ? ? ? ? ? will be in the right order """ > > Comments are written like this: > > ? ? ? ? ? ? ? ? ? ? ? ?# When the line is a FragLine or ParaLines, It's > ? ? ? ? ? ? ? ? ? ? ? ?# text attribute of each of it's words is flipped. > ? ? ? ? ? ? ? ? ? ? ? ?# Then, the order of the words is flipped too, > ? ? ? ? ? ? ? ? ? ? ? ?# So that 2 word parts on the same line > ? ? ? ? ? ? ? ? ? ? ? ?# will be in the right order > > Also, it's "its", not "It's". > >> ? ? ? ? ? ? ? ? ? ? ? for word in line.words: >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? word.text = pyfribidi.log2vis (word.text, base_direction = pyfribidi.ON) > > PEP-8 recommends no space in front of ( following a function name, and > no spaces around = when used to pass keyword arguments. > >> >> ? ? ? ? ? ? ? ? ? ? ? line.words.reverse() >> >> ? ? ? ? ? ? ? elif line.__class__.__name__ == 'tuple': > > isinstance(line, tuple) > >> ? ? ? ? ? ? ? ? ? ? ? """When the line is just a tuple whose second value is the text. >> ? ? ? ? ? ? ? ? ? ? ? since I coulden't directly change it's value, >> ? ? ? ? ? ? ? ? ? ? ? it's done by merging the words, flipping them, >> ? ? ? ? ? ? ? ? ? ? ? and re-entering them one by one to the second attribute """ >> >> ? ? ? ? ? ? ? ? ? ? ? s = ' '.join(line[1]) >> ? ? ? ? ? ? ? ? ? ? ? s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) >> ? ? ? ? ? ? ? ? ? ? ? line[1][:] = s.split() >> ? ? ? ? ? ? ? else: >> ? ? ? ? ? ? ? ? ? ? ? print line.__class__.__name__ > > This is for debugging purposes, right? > >> ? ? ? ? ? ? ? ? ? ? ? #print self.blPara.lines[i][1][1:] >> except ImportError: >> ? ? ? print "Fribidi module not found; You will not have rtl support for >> this paragraph" > > It's typically better to keep the part between try: and except: as small > as possible, thus it's idiomatic to write > > ? ?try: > ? ? ? ?import pyfribidi > ? ?except ImportError: > ? ? ? ?print >> sys.stderr, "Fribidi module not found ..." > ? ?else: > ? ? ? ?# code > > Printing to sys.stdout (or even sys.stderr) from a library is perhaps > bad style, but I'm not sure what's the right solution here. ?Either the > logging or the warnings module would be better. ?E.g. > > ? ?try: > ? ? ? ?import pyfribidi > ? ?except ImportError: > ? ? ? ?warnings.warn("Fribidi module not found ...") > ? ?else: > ? ? ? ?# code > >> ###################### >> >> Is there any chance this could be added to the official code? > > I'm not affiliated with Reportlab in any way (other than being a happy > user and a some-time contributor a long time ago), but I'd say yes. ?The > chances would be better if you added some tests for the new code. > > Marius Gedminas > -- > We have enough youth, how about a fountain of SMART? > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iD8DBQFKKRV6kVdEXeem148RAmRgAJ9dhfak9mq????????? > TWooIPPcqwnXOOM6XqZVh7E= > =DBGB > -----END PGP SIGNATURE----- > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > From moshe.wagner at gmail.com Sun Jun 7 07:09:07 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Sun, 7 Jun 2009 14:09:07 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: Well, I'm not a really great technical writer either, and I'm not really sure how much background you want. But I'll give the best description I can think of. As I said, feel free to change anything so it meets your requirements, or ask me to give more information on any point you think I didn't get into enough. (Note: I don't know enough about any other languages, so I'm strictly speaking about Hebrew. Arabic, for instance, is very similar in terms of being RTL, but has a few very different properties, such as joined letters. I do believe fribidi deals with that correctly, and therefore my patch should add Arabic support too, but I cannot promise that. Is there anyone who can test this? ) Displaying Hebrew - First step for displaying any non ASCII characters, and therefore Hebrew as well, is obtaining a font containing it's characters. I didn't check all of the default PDF fonts, but those I did, did not include Hebrew glyphs. Instead, I use fonts from the Culmus project (http://culmus.sourceforge.net). ( In the test archive I included one font from there, and it's license file. I hope that's ok) 'Visual' and 'Logical' ordering - Once a font with the characters is used, single Hebrew characters can be displayed, but the words will still come out mirrored, as I'll explain. Say we take the word hello, that is, "????" ("Shalom"). If you see it correctly, you will see the character "?" at the most right part of that word, as it's the first letter, and Hebrew is read from right to left. But if we would look at the word as an array of chars, 'c_str', the values would be: c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?". So when printed from left to right, as is usually done, the word will be shown as: "????", since the characters are printed by their real order (called 'logical'), but start from the wrong side. To avoid this, a 'visual' ordering is used instead of the 'logical' one. So the word "????" will be stored as - c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?", so when printed from left to right, it will be displayed as "????" - which is the correct order. The visual ordering must be used carefully, though, since when printing text that's split along a few lines, it will cause their order to switch too, as mirroring affects both axises. ( i.e, "???? ???", when each word is op a separate line, will be ???? ??? In logical ordering, and: ??? ???? In visual, which are both wrong.) The solution is to mirror every line on it's own, but that must be done in the wrapping function, but not before or after it. Fribidi and Pyfribidi - A library allowing to convert between 'logical' and 'visual' ordering, while testing if the text is RTL before mirroring it, and supporting mixed texts, where only the RTL part should be mirrored, is fribidi - "An implementation of the Unicode Bidirectional Algorithm (bidi)." - http://fribidi.org/. The python binding for this library is called pyfribidi - http://pyfribidi.sourceforge.net/ . (It does not require fribidi itself installed.) All versions of pyfribidi should work fine, but I suppose the newest version should always be used. My code - My code simply uses pyfribidi to add RTL (and mixed LTR and RTL strings) support to reportlab. In "canvas.py" it simply runs 'pyfribidi.log2vis' on the text, while in "paragraph.py" it does it to each line seperatly. This is I have added to the "canvas.py" file, right at the beginning of the "drawString" function: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) # If it could not be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi text = pyfribidi.log2vis(text,base_direction=pyfribidi.ON) except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" ##################### And this is what I added to "paragraph.py", in the "wrap" function, right after the call to "self.breakLines": ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line seperatly. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" else: for line in blPara.lines: if isinstance(line, (FragLine, ParaLines)): #When the line is a FragLine or ParaLines, Its #text attribute of each of it's words is flipped. #Then, the order of the words is flipped too, #So that 2 word parts on the same line #will be in the right order for word in line.words: word.text = pyfribidi.log2vis(word.text, base_direction=pyfribidi.ON) line.words.reverse() elif isinstance(line, tuple): #When the line is just a tuple whose second value is the text. #since I coulden't directly change it's value, #it's done by merging the words, flipping them, #and re-entering them one by one to the second attribute """ s = ' '.join(line[1]) s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) line[1][:] = s.split() else: print line.__class__.__name__ ###################### I attached an archive containing a Hebrew font, and a test script. The script should test all cases I know that my patch should deal with, and adds an image of good results for comparison. Moshe On Fri, Jun 5, 2009 at 4:37 PM, Andy Robinson wrote: > 2009/6/5 Moshe Wagner : >> Is there any chance this could be added to the official code? > > Moshe, thanks very much for your contribution. ?We're happy in > principle to add this kind of patch but it would help a great deal if > you could produce two more things... > > (a) a suitable few paragraphs for us to put in a Whats New page or the > user guide. ?Mention what pyfribidi is, what version is needed (if it > matters) and where to get it. ?Also mention what one needs to install > to view these things - do we need special fonts, Acrobat Language > packs etc..? ? Assume the reader knows nothing about RTL. ? ? Just > send text to me or the list and I'll add it to the docs and/or web > site. > > (b) most important of all, a small test script (see our 'tests' > folder) which generates some Hebrew and/or Arabic output, which we can > run and look at. ? The absolute ideal test script would have a bitmap > of the correct Hebrew to look at, and say "the text below should look > like the above", since I at least would not know if it was backwards > or forwards ;-) > > Most people in ReportLab are too busy to have been following this in > detail but we'd really welcome any improvement in this area. We are > also starting from zero knowledge of Hebrew and Arabic - unlike Asian > text which we deal with daily. ?There will be a release in a few weeks > and this would be a very valuable addition... > > 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 > -------------- next part -------------- A non-text attachment was scrubbed... Name: Report Lab RTL Test.tar.gz Type: application/x-gzip Size: 58586 bytes Desc: not available Url : From moshe.wagner at gmail.com Sun Jun 7 07:12:12 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Sun, 7 Jun 2009 14:12:12 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: Looking at my test again, I see there is still a bug with mixed texts. I'll update when I fix it. Moshe On Sun, Jun 7, 2009 at 2:09 PM, Moshe Wagner wrote: > Well, I'm not a really great technical writer either, and I'm not > really sure how much background you want. But I'll give the best > description I can think of. As I said, feel free to change anything so > it meets your requirements, or ask me to give more information on any > point you think I didn't get into enough. > > (Note: I don't know enough about any other languages, so I'm strictly > speaking about Hebrew. Arabic, for instance, is very similar in terms > of being RTL, but has a few very different properties, such as joined > letters. I do believe fribidi deals with that correctly, and therefore > my patch should add Arabic support too, but I cannot promise that. Is > there anyone who can test this? ?) > > Displaying Hebrew - > > First step for displaying any non ASCII characters, and therefore > Hebrew as well, is obtaining a font containing it's characters. I > didn't check all of the default PDF fonts, but those I did, did not > include Hebrew glyphs. > Instead, I use fonts from the Culmus project (http://culmus.sourceforge.net). > ( In the test archive I included one font from there, and it's license > file. I hope that's ok) > > > 'Visual' and 'Logical' ordering - > > Once a font with the characters is used, single Hebrew characters can > be displayed, but the words will still come out mirrored, as I'll > explain. > Say we take the word hello, that is, "????" ("Shalom"). If you see it > correctly, you will see the character "?" at the most right part of > that word, as it's the first letter, and Hebrew is read from right to > left. > But if we would look at the word as an array of chars, 'c_str', the > values would be: > c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?". > > So when printed from left to right, as is usually done, the word will > be shown as: > "????", > since the characters are printed by their real order (called > 'logical'), but start from the wrong side. > > To avoid this, a 'visual' ordering is used instead of the 'logical' one. > So the word "????" will be stored as - > c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?", so > when printed from left to right, it will be displayed as > "????" - which is the correct order. > > The visual ordering must be used carefully, though, since when > printing text that's split along a few lines, it will cause their > order to switch too, as mirroring affects both axises. > ( i.e, "???? ???", when each word is op a separate line, will be > ???? > ??? > In logical ordering, > and: > ??? > ???? > ?In visual, which are both wrong.) > The solution is to mirror every line on it's own, but that must be > done in the wrapping function, but not before or after it. > > > Fribidi and Pyfribidi - > > A library allowing to convert between 'logical' and 'visual' ordering, > while testing if the text is RTL before mirroring it, and supporting > mixed texts, where only the RTL part should be mirrored, is fribidi - > "An implementation of the Unicode Bidirectional Algorithm (bidi)." - > http://fribidi.org/. > > The python binding for this library is called pyfribidi - > http://pyfribidi.sourceforge.net/ . (It does not require fribidi > itself installed.) > All versions of pyfribidi should work fine, but I suppose the newest > version should always be used. > > My code - > My code simply uses pyfribidi to add RTL (and mixed LTR and RTL > strings) support to reportlab. > In "canvas.py" it simply runs 'pyfribidi.log2vis' on the text, while > in "paragraph.py" it does it to each line seperatly. > > This is I have added to the "canvas.py" file, right at the beginning > of the "drawString" function: > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) > # If it could not be imported, it does nothing > # Plain LTR texts will not be affected in any case. > try: > ? ? ? ?import pyfribidi > ? ? ? ?text = pyfribidi.log2vis(text,base_direction=pyfribidi.ON) > > except ImportError: > ? ? ? ?import sys > ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL > support for this paragraph" > ##################### > > And this is what I added to "paragraph.py", in the "wrap" function, > right after the call to "self.breakLines": > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > #This code fixes paragraphs with RTL text > > # It does it by flipping each line seperatly. > # ? ? ? (Depending on the type of the line) > > # If fribidi cant be imported, it does nothing > # Plain LTR texts will not be affected in any case. > > try: > ? ? ? ?import pyfribidi > except ImportError: > ? ? ? ?import sys > ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL > support for this paragraph" > else: > ? ? ? ?for line in blPara.lines: > ? ? ? ?if isinstance(line, (FragLine, ParaLines)): > ? ? ? ? ? ? ? ?#When the line is a FragLine or ParaLines, Its > ? ? ? ? ? ? ? ?#text attribute of each of it's words is flipped. > ? ? ? ? ? ? ? ?#Then, the order of the words is flipped too, > ? ? ? ? ? ? ? ?#So that 2 word parts on the same line > ? ? ? ? ? ? ? ?#will be in the right order > ? ? ? ? ? ? ? ?for word in line.words: > ? ? ? ? ? ? ? ?word.text = pyfribidi.log2vis(word.text, base_direction=pyfribidi.ON) > > ? ? ? ? ? ? ? ?line.words.reverse() > > ? ? ? ?elif isinstance(line, tuple): > ? ? ? ? ? ? ? ?#When the line is just a tuple whose second value is the text. > ? ? ? ? ? ? ? ?#since I coulden't directly change it's value, > ? ? ? ? ? ? ? ?#it's done by merging the words, flipping them, > ? ? ? ? ? ? ? ?#and re-entering them one by one to the second attribute """ > > ? ? ? ? ? ? ? ?s = ' '.join(line[1]) > ? ? ? ? ? ? ? ?s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) > ? ? ? ? ? ? ? ?line[1][:] = s.split() > ? ? ? ?else: > ? ? ? ? ? ? ? ?print line.__class__.__name__ > ###################### > > > > I attached an archive containing a Hebrew font, and a test script. > The script should test all cases I know that my patch should deal > with, and adds an image of good results for comparison. > > Moshe > > > On Fri, Jun 5, 2009 at 4:37 PM, Andy Robinson wrote: >> 2009/6/5 Moshe Wagner : >>> Is there any chance this could be added to the official code? >> >> Moshe, thanks very much for your contribution. ?We're happy in >> principle to add this kind of patch but it would help a great deal if >> you could produce two more things... >> >> (a) a suitable few paragraphs for us to put in a Whats New page or the >> user guide. ?Mention what pyfribidi is, what version is needed (if it >> matters) and where to get it. ?Also mention what one needs to install >> to view these things - do we need special fonts, Acrobat Language >> packs etc..? ? Assume the reader knows nothing about RTL. ? ? Just >> send text to me or the list and I'll add it to the docs and/or web >> site. >> >> (b) most important of all, a small test script (see our 'tests' >> folder) which generates some Hebrew and/or Arabic output, which we can >> run and look at. ? The absolute ideal test script would have a bitmap >> of the correct Hebrew to look at, and say "the text below should look >> like the above", since I at least would not know if it was backwards >> or forwards ;-) >> >> Most people in ReportLab are too busy to have been following this in >> detail but we'd really welcome any improvement in this area. We are >> also starting from zero knowledge of Hebrew and Arabic - unlike Asian >> text which we deal with daily. ?There will be a release in a few weeks >> and this would be a very valuable addition... >> >> 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 moshe.wagner at gmail.com Mon Jun 8 05:00:27 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Mon, 8 Jun 2009 12:00:27 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: Sorry, seems like a posted the code with a stupid bug. This is how it should be of course: (The other function is still fine) ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line separately. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" else: #First, the base direction given to pyfribidi must be decided. # In justified paragraphs, it's decided by their alignment. # For now, there is only one type of fill justified paragraphs. # So even though it acts like a left justified one, # we cannot assume that's the alignment the text should have. # So the direction is guessed by the first character of the text. if self.style.alignment == TA_LEFT: direction = pyfribidi.LTR elif self.style.alignment == TA_RIGHT: direction = pyfribidi.RTL else: # Get first character of the text: c = "" if isinstance(blPara.lines[0], (FragLine, ParaLines)): if len(blPara.lines[0].words[0].text) < 2: #This must be English, because Unicode chars take up 2 spaces in the array direction = pyfribidi.LTR else: c = blPara.lines[0].words[0].text[0] + blPara.lines[0].words[0].text[1] elif isinstance(blPara.lines[0], tuple): if len(blPara.lines[0][1]) < 2: #This must be English, because Unicode chars take up 2 spaces in the array direction = pyfribidi.LTR else: c = blPara.lines[0][1][0] + blPara.lines[0][1][1] #Guess direction by it: direction = self.guessBaseDirection(c) for line in blPara.lines: if isinstance(line, (FragLine, ParaLines)): #When the line is a FragLine or ParaLines, Its #text attribute of each of it's words is flipped. #Then, the order of the words is flipped too, #So that 2 word parts on the same line #will be in the right order for word in line.words: word.text = pyfribidi.log2vis(word.text,direction) line.words.reverse() elif isinstance(line, tuple): #When the line is just a tuple whose second value is the text. #since I coulden't directly change it's value, #it's done by merging the words, flipping them, #and re-entering them one by one to the second attribute """ s = ' '.join(line[1]) s = pyfribidi.log2vis(s,direction) line[1][:] = s.split() else: print line.__class__.__name__ ###################### Also, I forgot to point out the archive I attached with my last email includes the new test script for the patch. Sorry again, Moshe On Mon, Jun 8, 2009 at 11:42 AM, Moshe Wagner wrote: > Well, I believe I fixed the system dealing with mixed texts. > > The problem was that fribidi must have a base direction given for any line. > For instance, the line "hello world!", will stay intact when given to > fribidi if the base direction is LTR, but should become "!hello > world", if the base direction is RTL, since we want to look at it as > part of a RTL paragraph, and therefore the end of the line is on the > left. > > Until now, I used fribidi's auto detection for the base direction, but > since I did it for every line separately, it would treat a line like > the one I gave above always as LTR, ignoring the fact that it's in a > RTL paragraph. > > The new code deals with that now by determining the base direction by > the alignment type of the paragraph, and giving it to all lines in the > paragraph. > > The only problem is with filled paragraphs, where the base direction > can't be determined, since it still could be either RTL or LTR. > The best solution is to allow two types of filled alignments, > FILL_LEFT, and FILL_RIGHT, which is needed anyway for positioning the > last line correctly, as I mentioned before. > Could that be done? > > > Anyway, until that could be done, I made the code use fribidi's auto > detection for the base direction of filled paragraphs, so it's decided > by there first character. > It isn't ideal, but it works. > > So here is the new code: > ###################### > # Hebrew text patch, Moshe Wagner, June 2009 > # > > #This code fixes paragraphs with RTL text > > # It does it by flipping each line separately. > # ? ? ? (Depending on the type of the line) > > # If fribidi cant be imported, it does nothing > # Plain LTR texts will not be affected in any case. > try: > ? ?import pyfribidi > except ImportError: > ? ? ? ?import sys > ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not > have RTL support for this paragraph" > else: > > ? ?#First, the base direction given to pyfribidi must be decided. > ? ?# In justified paragraphs, it's decided by their alignment. > > ? ?# For now, there is only one type of fill justified paragraphs. > ? ?# So even though it acts like a left justified one, > ? ?# we cannot assume that's the alignment the text should have. > ? ?# So the direction is guessed by the first character of the text. > > ? ?if self.style.alignment == TA_LEFT: > ? ? ? ?direction = pyfribidi.LTR > ? ?elif self.style.alignment == TA_RIGHT: > ? ? ? ?direction = pyfribidi.RTL > ? ?else: > ? ? ? ?# Get first character of the text: > ? ? ? ?c = "" > ? ? ? ?if isinstance(blPara.lines[0], (FragLine, ParaLines)): > ? ? ? ? ? ?c = blPara.lines[0].words[0].text[0] + > blPara.lines[0].words[0].text[1] > ? ? ? ?elif isinstance(blPara.lines[0], tuple): > ? ? ? ? ? ?c = blPara.lines[0][1][0] + blPara.lines[0][1][1] > ? ? ? ?#Guess direction by it: > ? ? ? ?direction = self.guessBaseDirection(c) > > ? ?for line in blPara.lines: > ? ? ? ?if isinstance(line, (FragLine, ParaLines)): > ? ? ? ? ? ?#When the line is a FragLine or ParaLines, Its > ? ? ? ? ? ?#text attribute of each of it's words is flipped. > ? ? ? ? ? ?#Then, the order of the words is flipped too, > ? ? ? ? ? ?#So that 2 word parts on the same line > ? ? ? ? ? ?#will be in the right order > > ? ? ? ? ? ?for word in line.words: > ? ? ? ? ? ? ? ?word.text = pyfribidi.log2vis(word.text,direction) > > ? ? ? ? ? ?line.words.reverse() > > ? ? ? ?elif isinstance(line, tuple): > ? ? ? ? ? ?#When the line is just a tuple whose second value is the text. > ? ? ? ? ? ?#since I coulden't directly change it's value, > ? ? ? ? ? ?#it's done by merging the words, flipping them, > ? ? ? ? ? ?#and re-entering them one by one to the second attribute """ > > ? ? ? ? ? ?s = ' '.join(line[1]) > ? ? ? ? ? ?s = pyfribidi.log2vis(s,direction) > ? ? ? ? ? ?line[1][:] = s.split() > ? ? ? ?else: > ? ? ? ? ? ?print line.__class__.__name__ > ###################### > > And this function should be added before the 'wrap' function in the same class: > ############################### > # Guesses the direction the given text should have (LTR or RTL), for > cases where it can't be decided by it's alignment > def guessBaseDirection(self, s): > ? ?# ?Since pyfribidi doesn't have an option to return fribidi's guess, > ? ?# ?I have to find out it's guess in a very ugly way > > ? ?# This adds a neutral sign to the given text. > ? ?# Then the text is mirrored, letting fribidi to guess it's direction. > ? ?# If it's RTL text, the added sign will now become the first > character of the text, > ? ?# ?While if it's LTR the sign will stay at the end. > ? ?import pyfribidi > > ? ?s += '.' > ? ?s = pyfribidi.log2vis(s,pyfribidi.ON) > > ? ?if (s[0] == "."): > ? ? ? ?return pyfribidi.RTL > ? ?else: > ? ? ? ?return pyfribidi.LTR > ############################### > > > Moshe > > Another point I got wrong is that pyfribidi *DOES* require fribidi > itself, not like I said before. > > > On Sun, Jun 7, 2009 at 2:12 PM, Moshe Wagner wrote: >> Looking at my test again, I see there is still a bug with mixed texts. >> I'll update when I fix it. >> >> Moshe >> >> On Sun, Jun 7, 2009 at 2:09 PM, Moshe Wagner wrote: >>> Well, I'm not a really great technical writer either, and I'm not >>> really sure how much background you want. But I'll give the best >>> description I can think of. As I said, feel free to change anything so >>> it meets your requirements, or ask me to give more information on any >>> point you think I didn't get into enough. >>> >>> (Note: I don't know enough about any other languages, so I'm strictly >>> speaking about Hebrew. Arabic, for instance, is very similar in terms >>> of being RTL, but has a few very different properties, such as joined >>> letters. I do believe fribidi deals with that correctly, and therefore >>> my patch should add Arabic support too, but I cannot promise that. Is >>> there anyone who can test this? ?) >>> >>> Displaying Hebrew - >>> >>> First step for displaying any non ASCII characters, and therefore >>> Hebrew as well, is obtaining a font containing it's characters. I >>> didn't check all of the default PDF fonts, but those I did, did not >>> include Hebrew glyphs. >>> Instead, I use fonts from the Culmus project (http://culmus.sourceforge.net). >>> ( In the test archive I included one font from there, and it's license >>> file. I hope that's ok) >>> >>> >>> 'Visual' and 'Logical' ordering - >>> >>> Once a font with the characters is used, single Hebrew characters can >>> be displayed, but the words will still come out mirrored, as I'll >>> explain. >>> Say we take the word hello, that is, "????" ("Shalom"). If you see it >>> correctly, you will see the character "?" at the most right part of >>> that word, as it's the first letter, and Hebrew is read from right to >>> left. >>> But if we would look at the word as an array of chars, 'c_str', the >>> values would be: >>> c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?". >>> >>> So when printed from left to right, as is usually done, the word will >>> be shown as: >>> "????", >>> since the characters are printed by their real order (called >>> 'logical'), but start from the wrong side. >>> >>> To avoid this, a 'visual' ordering is used instead of the 'logical' one. >>> So the word "????" will be stored as - >>> c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?", so >>> when printed from left to right, it will be displayed as >>> "????" - which is the correct order. >>> >>> The visual ordering must be used carefully, though, since when >>> printing text that's split along a few lines, it will cause their >>> order to switch too, as mirroring affects both axises. >>> ( i.e, "???? ???", when each word is op a separate line, will be >>> ???? >>> ??? >>> In logical ordering, >>> and: >>> ??? >>> ???? >>> ?In visual, which are both wrong.) >>> The solution is to mirror every line on it's own, but that must be >>> done in the wrapping function, but not before or after it. >>> >>> >>> Fribidi and Pyfribidi - >>> >>> A library allowing to convert between 'logical' and 'visual' ordering, >>> while testing if the text is RTL before mirroring it, and supporting >>> mixed texts, where only the RTL part should be mirrored, is fribidi - >>> "An implementation of the Unicode Bidirectional Algorithm (bidi)." - >>> http://fribidi.org/. >>> >>> The python binding for this library is called pyfribidi - >>> http://pyfribidi.sourceforge.net/ . (It does not require fribidi >>> itself installed.) >>> All versions of pyfribidi should work fine, but I suppose the newest >>> version should always be used. >>> >>> My code - >>> My code simply uses pyfribidi to add RTL (and mixed LTR and RTL >>> strings) support to reportlab. >>> In "canvas.py" it simply runs 'pyfribidi.log2vis' on the text, while >>> in "paragraph.py" it does it to each line seperatly. >>> >>> This is I have added to the "canvas.py" file, right at the beginning >>> of the "drawString" function: >>> ###################### >>> # Hebrew text patch, Moshe Wagner, June 2009 >>> # >>> >>> # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) >>> # If it could not be imported, it does nothing >>> # Plain LTR texts will not be affected in any case. >>> try: >>> ? ? ? ?import pyfribidi >>> ? ? ? ?text = pyfribidi.log2vis(text,base_direction=pyfribidi.ON) >>> >>> except ImportError: >>> ? ? ? ?import sys >>> ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL >>> support for this paragraph" >>> ##################### >>> >>> And this is what I added to "paragraph.py", in the "wrap" function, >>> right after the call to "self.breakLines": >>> ###################### >>> # Hebrew text patch, Moshe Wagner, June 2009 >>> # >>> >>> #This code fixes paragraphs with RTL text >>> >>> # It does it by flipping each line seperatly. >>> # ? ? ? (Depending on the type of the line) >>> >>> # If fribidi cant be imported, it does nothing >>> # Plain LTR texts will not be affected in any case. >>> >>> try: >>> ? ? ? ?import pyfribidi >>> except ImportError: >>> ? ? ? ?import sys >>> ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL >>> support for this paragraph" >>> else: >>> ? ? ? ?for line in blPara.lines: >>> ? ? ? ?if isinstance(line, (FragLine, ParaLines)): >>> ? ? ? ? ? ? ? ?#When the line is a FragLine or ParaLines, Its >>> ? ? ? ? ? ? ? ?#text attribute of each of it's words is flipped. >>> ? ? ? ? ? ? ? ?#Then, the order of the words is flipped too, >>> ? ? ? ? ? ? ? ?#So that 2 word parts on the same line >>> ? ? ? ? ? ? ? ?#will be in the right order >>> ? ? ? ? ? ? ? ?for word in line.words: >>> ? ? ? ? ? ? ? ?word.text = pyfribidi.log2vis(word.text, base_direction=pyfribidi.ON) >>> >>> ? ? ? ? ? ? ? ?line.words.reverse() >>> >>> ? ? ? ?elif isinstance(line, tuple): >>> ? ? ? ? ? ? ? ?#When the line is just a tuple whose second value is the text. >>> ? ? ? ? ? ? ? ?#since I coulden't directly change it's value, >>> ? ? ? ? ? ? ? ?#it's done by merging the words, flipping them, >>> ? ? ? ? ? ? ? ?#and re-entering them one by one to the second attribute """ >>> >>> ? ? ? ? ? ? ? ?s = ' '.join(line[1]) >>> ? ? ? ? ? ? ? ?s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) >>> ? ? ? ? ? ? ? ?line[1][:] = s.split() >>> ? ? ? ?else: >>> ? ? ? ? ? ? ? ?print line.__class__.__name__ >>> ###################### >>> >>> >>> >>> I attached an archive containing a Hebrew font, and a test script. >>> The script should test all cases I know that my patch should deal >>> with, and adds an image of good results for comparison. >>> >>> Moshe >>> >>> >>> On Fri, Jun 5, 2009 at 4:37 PM, Andy Robinson wrote: >>>> 2009/6/5 Moshe Wagner : >>>>> Is there any chance this could be added to the official code? >>>> >>>> Moshe, thanks very much for your contribution. ?We're happy in >>>> principle to add this kind of patch but it would help a great deal if >>>> you could produce two more things... >>>> >>>> (a) a suitable few paragraphs for us to put in a Whats New page or the >>>> user guide. ?Mention what pyfribidi is, what version is needed (if it >>>> matters) and where to get it. ?Also mention what one needs to install >>>> to view these things - do we need special fonts, Acrobat Language >>>> packs etc..? ? Assume the reader knows nothing about RTL. ? ? Just >>>> send text to me or the list and I'll add it to the docs and/or web >>>> site. >>>> >>>> (b) most important of all, a small test script (see our 'tests' >>>> folder) which generates some Hebrew and/or Arabic output, which we can >>>> run and look at. ? The absolute ideal test script would have a bitmap >>>> of the correct Hebrew to look at, and say "the text below should look >>>> like the above", since I at least would not know if it was backwards >>>> or forwards ;-) >>>> >>>> Most people in ReportLab are too busy to have been following this in >>>> detail but we'd really welcome any improvement in this area. We are >>>> also starting from zero knowledge of Hebrew and Arabic - unlike Asian >>>> text which we deal with daily. ?There will be a release in a few weeks >>>> and this would be a very valuable addition... >>>> >>>> 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 gherman at darwin.in-berlin.de Mon Jun 8 05:33:27 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 8 Jun 2009 11:33:27 +0200 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: <39B0EC64-874A-438F-8014-117066AEF89B@darwin.in-berlin.de> Moshe Wagner: > Sorry, seems like a posted the code with a stupid bug. This is how it > should be of course: [...] Moshe, it would be helpful to cite only those pieces of previous postings that you really refer to, are relevant to your response and that you do expect others to re-read with your response. For me at least, three levels of code are to much to bear. Surely one can ignore them, but why would you want to lower the signal to noise ratio in your postings? Thanks, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Mon Jun 8 06:36:56 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 8 Jun 2009 11:36:56 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: <956003ae0906080336n5428ce99x8c2ac0bbf171abd7@mail.gmail.com> 2009/6/7 Moshe Wagner : > Well, I'm not a really great technical writer either, and I'm not > really sure how much background you want. But I'll give the best > description I can think of. Moshe, this is a great start. Thanks very much indeed. We'll do our best to get this into the 2.4 release in some fashion. Don't panic if nothing goes in this week - we're shortstaffed with someone on vacation - but we're starting to collect features for the next release now. For completeness' sake are there any others out there who are using ReportLab with Arabic, and who could see if this approach works and/or give us some sample text when we start to make the changes? Best Regards, Andy Robinson From andy at reportlab.com Mon Jun 8 06:57:07 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 8 Jun 2009 11:57:07 +0100 Subject: [reportlab-users] Using PDF as an image in a ReportLab document In-Reply-To: <200906051516.49124.ralsina@netmanagers.com.ar> References: <200906051516.49124.ralsina@netmanagers.com.ar> Message-ID: <956003ae0906080357p4cd2b204mdb9beba0b3474966@mail.gmail.com> 2009/6/5 Roberto Alsina : > This is caused by an issue reported about rst2pdf: > > http://code.google.com/p/rst2pdf/issues/detail?id=127 > > Basically: is there a way to use a PDF file like we use a PNG file, to do an > Image or Image-like flowable? ReportLab's commercial products can use PDF files as 'images' - in 'Genuine RML(tm)' you can use a PDF file anywhere you can use a PNG. We do not intend to give this feature away as it's one of the main reasons for people to upgrade and buy our software. However, in the open-source world, the only technique I am aware of is Dinu's one which uses py2pdf to do some kind of postprocessing of two PDF files. 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 Mon Jun 8 12:06:03 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 08 Jun 2009 17:06:03 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: <4A2D36EB.1020300@chamonix.reportlab.co.uk> Is it possible you could post a context difference for all the files you modified? It would make it easier to get this in. Alternatively is the archive + your last email definitive? In addition I'm not sure I understand how this would be used in a production environment. Do we need to have a style setting rather like Andy has used style.wordwrap=='CJK' to test for when we switch to CJK style wrapping? If we use that approach we should be able to put the patch in place more easily. However, styling seems hard for ordinary string drawing (ie we don't have it). Or are we saying that we have a pyfribidi mode when all text gets rendered that way? -- Robin Becker From andy at reportlab.com Mon Jun 8 12:58:02 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 8 Jun 2009 17:58:02 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <4A2D36EB.1020300@chamonix.reportlab.co.uk> References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> <4A2D36EB.1020300@chamonix.reportlab.co.uk> Message-ID: <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> 2009/6/8 Robin Becker : > Do we need to have a style setting rather like Andy has used > style.wordwrap=='CJK' to test for when we switch to CJK style wrapping? If > we use that approach we should be able to put the patch in place more > easily. That's my favourite approach. style.wordwrap='RTL'? I know it's a bit of a hack but so was the CJK, and it's at least compatible and consistent. 'wordwrap' is specifying which algorithm to use. I wonder if we should also allow this to be loaded from the config file, so that somebody could globally specify RTL or CJK as the default for their project? - Andy From robin at reportlab.com Mon Jun 8 13:13:52 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 08 Jun 2009 18:13:52 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> Message-ID: <4A2D46D0.2090008@chamonix.reportlab.co.uk> Andy Robinson wrote: > 2009/6/8 Robin Becker : >> Do we need to have a style setting rather like Andy has used >> style.wordwrap=='CJK' to test for when we switch to CJK style wrapping? If >> we use that approach we should be able to put the patch in place more >> easily. > > That's my favourite approach. style.wordwrap='RTL'? > > > I know it's a bit of a hack but so was the CJK, and it's at least > compatible and consistent. 'wordwrap' is specifying which algorithm > to use. > > I wonder if we should also allow this to be loaded from the config > file, so that somebody could globally specify RTL or CJK as the > default for their project? > > - Andy I think the main problem is canvas.drawString where the original patch is doing an import. Probably we ought to provide some mechanism to modify the method globally. There are all the string methods in charts etc etc to think of as well. -- Robin Becker From ralsina at netmanagers.com.ar Mon Jun 8 16:25:50 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 08 Jun 2009 17:25:50 -0300 Subject: [reportlab-users] Using PDF as an image in a ReportLab document References: <200906051516.49124.ralsina@netmanagers.com.ar> <956003ae0906080357p4cd2b204mdb9beba0b3474966@mail.gmail.com> Message-ID: Andy Robinson writes: > 2009/6/5 Roberto Alsina : >> This is caused by an issue reported about rst2pdf: >> >> http://code.google.com/p/rst2pdf/issues/detail?id=127 >> >> Basically: is there a way to use a PDF file like we use a PNG file, to do an >> Image or Image-like flowable? > > ReportLab's commercial products can use PDF files as 'images' - in > 'Genuine RML(tm)' you can use a PDF file anywhere you can use a PNG. > We do not intend to give this feature away as it's one of the main > reasons for people to upgrade and buy our software. Ok. > However, in the open-source world, the only technique I am aware of is > Dinu's one which uses py2pdf to do some kind of postprocessing of two > PDF files. Will take a look. Thanks for the lead. From andy at reportlab.com Mon Jun 8 18:19:02 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 8 Jun 2009 23:19:02 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <4A2D46D0.2090008@chamonix.reportlab.co.uk> References: <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> Message-ID: <956003ae0906081519t7fd0fad5y4430741a92cdfa36@mail.gmail.com> 2009/6/8 Robin Becker : > I think the main problem is canvas.drawString where the original patch is > doing an import. Probably we ought to provide some mechanism to modify the > method globally. There are all the string methods in charts etc etc to think > of as well. .truh daeh ym sekam idiB .taht fo thguoht t'ndaH ydnA - From simone.dalmasso at gmail.com Tue Jun 9 05:16:34 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Tue, 9 Jun 2009 11:16:34 +0200 Subject: [reportlab-users] Table not drawn Message-ID: Hi list, I'm trying to draw a table on a document. This is part of my code: * canv = canvas.Canvas(response,pagesize = A4)* * data = [['Hello'],['World']] t = Table(data,10 * cm,5 * cm) w,h = t.wrap(10 * cm,5 * cm) t.drawOn(canv,A4[0],A4[1]) canv.showPage() canv.save()* The document is created but unfortunately it's empty. Using a simple string instead of a table it works. Have you any advices? Thanks a lot. Simone -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Tue Jun 9 05:52:24 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 09 Jun 2009 10:52:24 +0100 Subject: [reportlab-users] Table not drawn In-Reply-To: References: Message-ID: <4A2E30D8.5000304@chamonix.reportlab.co.uk> Simone Dalmasso wrote: > Hi list, I'm trying to draw a table on a document. This is part of my code: > * canv = canvas.Canvas(response,pagesize = A4)* > * data = [['Hello'],['World']] > t = Table(data,10 * cm,5 * cm) > w,h = t.wrap(10 * cm,5 * cm) > t.drawOn(canv,A4[0],A4[1]) > canv.showPage() > canv.save()* > The document is created but unfortunately it's empty. Using a simple string > instead of a table it works. > Have you any advices? > > Thanks a lot. > Simone ........ Tables are supposed to be drawn in a flowable environment so they're drawn top leftish if you get what I mean. I suspect you need to change to t.drawOn(canv,A4[0],A4[1]-h) -- Robin Becker From simone.dalmasso at gmail.com Tue Jun 9 06:05:18 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Tue, 9 Jun 2009 12:05:18 +0200 Subject: [reportlab-users] Table not drawn In-Reply-To: <4A2E30D8.5000304@chamonix.reportlab.co.uk> References: <4A2E30D8.5000304@chamonix.reportlab.co.uk> Message-ID: Thanks, I tried but the file it's still white... Simone 2009/6/9 Robin Becker > Simone Dalmasso wrote: > >> Hi list, I'm trying to draw a table on a document. This is part of my >> code: >> * canv = canvas.Canvas(response,pagesize = A4)* >> * data = [['Hello'],['World']] >> t = Table(data,10 * cm,5 * cm) >> w,h = t.wrap(10 * cm,5 * cm) >> t.drawOn(canv,A4[0],A4[1]) >> canv.showPage() >> canv.save()* >> The document is created but unfortunately it's empty. Using a simple >> string >> instead of a table it works. >> Have you any advices? >> >> Thanks a lot. >> Simone >> > ........ > > Tables are supposed to be drawn in a flowable environment so they're drawn > top leftish if you get what I mean. I suspect you need to change to > > t.drawOn(canv,A4[0],A4[1]-h) > > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjf at pearson.co.uk Tue Jun 9 06:19:05 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Tue, 09 Jun 2009 11:19:05 +0100 Subject: [reportlab-users] Table not drawn In-Reply-To: <4A2E30D8.5000304@chamonix.reportlab.co.uk> References: <4A2E30D8.5000304@chamonix.reportlab.co.uk> Message-ID: <4A2E3719.708@pearson.co.uk> Robin Becker wrote: > Simone Dalmasso wrote: >> Hi list, I'm trying to draw a table on a document. This is part of my >> code: >> * canv = canvas.Canvas(response,pagesize = A4)* >> * data = [['Hello'],['World']] >> t = Table(data,10 * cm,5 * cm) >> w,h = t.wrap(10 * cm,5 * cm) >> t.drawOn(canv,A4[0],A4[1]) >> canv.showPage() >> canv.save()* >> The document is created but unfortunately it's empty. Using a simple >> string >> instead of a table it works. >> Have you any advices? >> >> Thanks a lot. >> Simone > ........ > > Tables are supposed to be drawn in a flowable environment so they're > drawn top leftish if you get what I mean. I suspect you need to change to > > t.drawOn(canv,A4[0],A4[1]-h) > Surely it's t.drawOn(canv,0,A4[1]-h) to make the table appear in the top-left corner of the page. The coordinates passed to Flowable.drawOn() are for the bottom-left corner of where it should draw itself. Matt Folwell From robin at reportlab.com Tue Jun 9 07:06:43 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 09 Jun 2009 12:06:43 +0100 Subject: [reportlab-users] Table not drawn In-Reply-To: <4A2E3719.708@pearson.co.uk> References: <4A2E30D8.5000304@chamonix.reportlab.co.uk> <4A2E3719.708@pearson.co.uk> Message-ID: <4A2E4243.2060007@chamonix.reportlab.co.uk> Matt Folwell wrote: > Robin Becker wrote: >> Simone Dalmasso wrote: >>> Hi list, I'm trying to draw a table on a document. This is part of my >>> code: >>> * canv = canvas.Canvas(response,pagesize = A4)* >>> * data = [['Hello'],['World']] >>> t = Table(data,10 * cm,5 * cm) >>> w,h = t.wrap(10 * cm,5 * cm) >>> t.drawOn(canv,A4[0],A4[1]) >>> canv.showPage() >>> canv.save()* >>> The document is created but unfortunately it's empty. Using a simple >>> string >>> instead of a table it works. >>> Have you any advices? >>> >>> Thanks a lot. >>> Simone >> ........ >> >> Tables are supposed to be drawn in a flowable environment so they're >> drawn top leftish if you get what I mean. I suspect you need to change to >> >> t.drawOn(canv,A4[0],A4[1]-h) >> > > Surely it's > > t.drawOn(canv,0,A4[1]-h) > > to make the table appear in the top-left corner of the page. > > The coordinates passed to Flowable.drawOn() are for the bottom-left > corner of where it should draw itself. > yes I think you're right. -- Robin Becker From simone.dalmasso at gmail.com Tue Jun 9 08:07:31 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Tue, 9 Jun 2009 14:07:31 +0200 Subject: [reportlab-users] Table not drawn In-Reply-To: <4A2E4243.2060007@chamonix.reportlab.co.uk> References: <4A2E30D8.5000304@chamonix.reportlab.co.uk> <4A2E3719.708@pearson.co.uk> <4A2E4243.2060007@chamonix.reportlab.co.uk> Message-ID: Yes! It works! Thanks a lot. Simone 2009/6/9 Robin Becker > Matt Folwell wrote: > >> Robin Becker wrote: >> >>> Simone Dalmasso wrote: >>> >>>> Hi list, I'm trying to draw a table on a document. This is part of my >>>> code: >>>> * canv = canvas.Canvas(response,pagesize = A4)* >>>> * data = [['Hello'],['World']] >>>> t = Table(data,10 * cm,5 * cm) >>>> w,h = t.wrap(10 * cm,5 * cm) >>>> t.drawOn(canv,A4[0],A4[1]) >>>> canv.showPage() >>>> canv.save()* >>>> The document is created but unfortunately it's empty. Using a simple >>>> string >>>> instead of a table it works. >>>> Have you any advices? >>>> >>>> Thanks a lot. >>>> Simone >>>> >>> ........ >>> >>> Tables are supposed to be drawn in a flowable environment so they're >>> drawn top leftish if you get what I mean. I suspect you need to change to >>> >>> t.drawOn(canv,A4[0],A4[1]-h) >>> >>> >> Surely it's >> >> t.drawOn(canv,0,A4[1]-h) >> >> to make the table appear in the top-left corner of the page. >> >> The coordinates passed to Flowable.drawOn() are for the bottom-left corner >> of where it should draw itself. >> >> yes I think you're right. > -- > Robin Becker > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simone.dalmasso at gmail.com Wed Jun 10 03:24:30 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Wed, 10 Jun 2009 09:24:30 +0200 Subject: [reportlab-users] Wrapping text into a table's cell Message-ID: Hi list, I have a table which retrieves some text from a db, my problem is that the text is not wrapped into the cell, so if I sepcify the colsWidth the text is printed in one line anyway. Is there a built in option to automatically split the text rows? Thanks in advance. Simone -------------- next part -------------- An HTML attachment was scrubbed... URL: From wietse.j at gmail.com Wed Jun 10 04:07:54 2009 From: wietse.j at gmail.com (Wietse Jacobs) Date: Wed, 10 Jun 2009 10:07:54 +0200 Subject: [reportlab-users] Wrapping text into a table's cell In-Reply-To: References: Message-ID: <7d9c65800906100107w14ddea44p8e183ac7f0ad6547@mail.gmail.com> 2009/6/10 Simone Dalmasso > Hi list, I have a table which retrieves some text from a db, my problem is > that the text is not wrapped into the cell, so if I sepcify the colsWidth > the text is printed in one line anyway. > Is there a built in option to automatically split the text rows? You can put a `Paragraph` in a table cell to achieve this. > Thanks in advance. > > Simone > > -- --Wietse -------------- next part -------------- An HTML attachment was scrubbed... URL: From simone.dalmasso at gmail.com Wed Jun 10 08:46:35 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Wed, 10 Jun 2009 14:46:35 +0200 Subject: [reportlab-users] Wrapping text into a table's cell In-Reply-To: <7d9c65800906100107w14ddea44p8e183ac7f0ad6547@mail.gmail.com> References: <7d9c65800906100107w14ddea44p8e183ac7f0ad6547@mail.gmail.com> Message-ID: Thank you very much Wietse, it works. 2009/6/10 Wietse Jacobs > 2009/6/10 Simone Dalmasso > >> Hi list, I have a table which retrieves some text from a db, my problem is >> that the text is not wrapped into the cell, so if I sepcify the colsWidth >> the text is printed in one line anyway. >> Is there a built in option to automatically split the text rows? > > > You can put a `Paragraph` in a table cell to achieve this. > > >> Thanks in advance. >> >> Simone >> >> -- > --Wietse > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Wed Jun 10 09:13:39 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 10 Jun 2009 15:13:39 +0200 Subject: [reportlab-users] Howto force a value axes to end in a tick? Message-ID: Hi, while having fun with AreaLinePlots I wonder if there is a way to specify for a value axis to chose ticks such that the maximum value displayed by the chart always falls on the chart's border- line (or somewhere "close" to that, but inside the chart area)? In fact, this question is independant of AreaLinePlot, but I'll have to raise some more issues with AreaLinePlot in further post- ings... Thanks/Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Wed Jun 10 09:19:16 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 10 Jun 2009 15:19:16 +0200 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <4A2556BF.30208@probo.com> References: <4A2556BF.30208@probo.com> Message-ID: <6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de> Tim Roberts: > Dinu Gherman wrote: >> >> seems like only few people are twittering about ReportLab. > > Yes. The rest of us are actually trying to get work done. Right, as right as with the telephone for some of us, I guess. > Honestly, but I fail to see any compelling business advantage at all > in > devoting resources to "twittering". Maybe this will provide some clues: http://247wallst.com/2009/05/26/the-ten-ways-twitter-will-permanently-change-american-business/ Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Jun 10 09:50:43 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 10 Jun 2009 14:50:43 +0100 Subject: [reportlab-users] Howto force a value axes to end in a tick? In-Reply-To: References: Message-ID: <4A2FBA33.2080505@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Hi, > > while having fun with AreaLinePlots I wonder if there is a way > to specify for a value axis to chose ticks such that the maximum > value displayed by the chart always falls on the chart's border- > line (or somewhere "close" to that, but inside the chart area)? > > In fact, this question is independant of AreaLinePlot, but I'll > have to raise some more issues with AreaLinePlot in further post- > ings... > > Thanks/Regards, > > Dinu > > ...................................................................... > Follow me on Twitter: http://twitter.com/dinugherman > > ........ I think you need to look at ValueAxis' rangeRound attribute. rangeRound can be 'none', 'ceiling', 'floor' or 'both'. The default means use whatever range we are given and then (usually the axis ends without ticks). To make the upper end have a tick use ceiling similarly for the lower end with floor; botth makes the range end on a tick for upper and lower limits. There might be better ways to do this, but all we're doing really is working out a tick scheme and then faking the range to include the potentially missing ticks. Of course given the ticking scheme that might make the new ticks fail again. A related attribute is avoidBoundFrac which can be None or a number or a pair of numbers. That tells the axis what fraction of the tick interval we need to leave between the limit values and the top/bottom of the chart. So if we end up with a maximum point of 1.0 and the top of the axis is 1.0 then ticked or not the chart area coincides with the limit point; some designers don't like that. Setting avoidBoundFrac to say 0.1 would insure that at least some fraction .1 of the tick interval would be added at the top. That would probably force the axis to extend to 1.025 or whatever so that some space is left free. -- Robin Becker From timr at probo.com Wed Jun 10 16:19:04 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 10 Jun 2009 13:19:04 -0700 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de> References: <4A2556BF.30208@probo.com> <6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de> Message-ID: <4A301538.4020407@probo.com> Dinu Gherman wrote: > Tim Roberts: > >> Honestly, but I fail to see any compelling business advantage at all in >> devoting resources to "twittering". > > Maybe this will provide some clues: > > http://247wallst.com/2009/05/26/the-ten-ways-twitter-will-permanently-change-american-business/ Well, that article describes how corporations will eventually invade and usurp Twitter, turning it into yet another mass advertising tool, which will inevitably render it useless to the general public. I still don't see how it benefits my company to have me Twitter. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From PEASLPW at mmc.org Wed Jun 10 16:35:13 2009 From: PEASLPW at mmc.org (Paul Peaslee) Date: Wed, 10 Jun 2009 16:35:13 -0400 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <4A301538.4020407@probo.com> References: <4A2556BF.30208@probo.com> <6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de><6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de> <4A301538.4020407@probo.com> Message-ID: <4A2FE0C1.65E7.00AC.0@mmc.org> I don't get it either... But I hate cell phones and pagers, and I don't see much use for instant messaging, either. I was recently criticized for not running email notify continuously. Not a team player... I wonder how people get anything done. By the way.... top or bottom posting preferred? Does it matter? Bo Paul 'Bo' Peaslee Database Administrator Maine Medical Center peaslpw at mmc.org 207.662.6523 >>> Tim Roberts 06/10/2009 16:19 >>> Dinu Gherman wrote: > Tim Roberts: > >> Honestly, but I fail to see any compelling business advantage at all in >> devoting resources to "twittering". > > Maybe this will provide some clues: > > http://247wallst.com/2009/05/26/the-ten-ways-twitter-will-permanently-change-american-business/ Well, that article describes how corporations will eventually invade and usurp Twitter, turning it into yet another mass advertising tool, which will inevitably render it useless to the general public. I still don't see how it benefits my company to have me Twitter. -- 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 CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the use of the intended recipient(s) only and may contain information that is privileged, confidential, and prohibited from unauthorized disclosure under applicable law. If you are not the intended recipient of this message, any dissemination, distribution, or copying of this message is strictly prohibited. If you received this message in error, please notify the sender by reply email and destroy all copies of the original message and attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Wed Jun 10 16:38:45 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 10 Jun 2009 21:38:45 +0100 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <4A2FE0C1.65E7.00AC.0@mmc.org> References: <4A2556BF.30208@probo.com> <6EDAD983-EDC1-4F88-A121-331C8A34F365@darwin.in-berlin.de> <4A301538.4020407@probo.com> <4A2FE0C1.65E7.00AC.0@mmc.org> Message-ID: <956003ae0906101338o46496557gbfae1aa24582988@mail.gmail.com> 2009/6/10 Paul Peaslee : > By the way.... top or bottom posting preferred?? Does it matter? Who cares, as long as it's short and removes the confidentiality notices! From tim at reportlab.com Thu Jun 11 03:58:36 2009 From: tim at reportlab.com (Tim Grant) Date: Thu, 11 Jun 2009 08:58:36 +0100 Subject: [reportlab-users] [Fwd: bug (and patch) pdfbase.pdfdoc.PDFFormXObject.format()] Message-ID: <4A30B92C.2070103@reportlab.com> -------- Original Message -------- Subject: bug (and patch) pdfbase.pdfdoc.PDFFormXObject.format() Date: Wed, 10 Jun 2009 14:39:42 -0600 From: scottm at walkermowers.com To: enquiries at reportlab.com bug in (and patch for) pdfbase.pdfdoc.PDFFormXObject.format() No response is requested. I just hope to see this minor fix in a future version. BUG: pdfbase.pdfdoc.PDFFormXObject.format() function will fail if self.Resources is previously defined. If self.Resources is already defined before .format() call it will raise "resources" is not defined error. if not self.Resources: # <-- what is the point of checking unless you wish to support previously defined self.Resources resources = PDFResourceDictionary() ... self.Resources=resources # <--self.Resources should be set at the end of this block ... sdict["Resources"] = resources # <-- this should use self.Resources instead of resources. return .... PATCH: patch -p1 From robin at reportlab.com Thu Jun 11 04:51:26 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 11 Jun 2009 09:51:26 +0100 Subject: [reportlab-users] [Fwd: bug (and patch) pdfbase.pdfdoc.PDFFormXObject.format()] In-Reply-To: <4A30B92C.2070103@reportlab.com> References: <4A30B92C.2070103@reportlab.com> Message-ID: <4A30C58E.9060405@chamonix.reportlab.co.uk> Thanks Scott, I'll take a look real soon now. Tim Grant wrote: > > > -------- Original Message -------- > Subject: bug (and patch) pdfbase.pdfdoc.PDFFormXObject.format() > Date: Wed, 10 Jun 2009 14:39:42 -0600 > From: scottm at walkermowers.com > To: enquiries at reportlab.com > > > > bug in (and patch for) pdfbase.pdfdoc.PDFFormXObject.format() > > No response is requested. I just hope to see this minor fix in a future > version. > > BUG: pdfbase.pdfdoc.PDFFormXObject.format() function will fail if > self.Resources is previously defined. > If self.Resources is already defined before .format() call it will raise > "resources" is not defined error. > > if not self.Resources: # <-- what is the point of checking unless you > wish to support previously defined self.Resources > resources = PDFResourceDictionary() > ... > self.Resources=resources # <--self.Resources should be set at the end > of this block > ... > sdict["Resources"] = resources # <-- this should use self.Resources > instead of resources. > return .... > > PATCH: patch -p1 > Thanks. -Scott Meyer, Walker Manufacturing man/listinfo/reportlab-users -- Robin Becker From marius at gedmin.as Thu Jun 11 10:25:37 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 11 Jun 2009 17:25:37 +0300 Subject: [reportlab-users] ReportLab, Twitter, Matplotlib In-Reply-To: <4A2FE0C1.65E7.00AC.0@mmc.org> References: <4A2556BF.30208@probo.com> <4A301538.4020407@probo.com> <4A2FE0C1.65E7.00AC.0@mmc.org> Message-ID: <20090611142537.GA16983@platonas> On Wed, Jun 10, 2009 at 04:35:13PM -0400, Paul Peaslee wrote: > By the way.... top or bottom posting preferred? Does it matter? People who care prefer bottom posting (and, especially, appropriate trimming of quotes). Marius Gedminas -- The day after tomorrow is the third day of the rest of your life. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From michael.dorrian at gmail.com Thu Jun 11 10:38:06 2009 From: michael.dorrian at gmail.com (Michael Dorrian) Date: Thu, 11 Jun 2009 23:38:06 +0900 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table Message-ID: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> I read data from the database and want to input it into a reportlab table but i need to loop through the returned rows from my sql statement and add rows to the table while doing so. The following reportlab helper class is perfect for what i need but because i am returning japanese strings this library comes back with errors. http://code.google.com/p/podunk/ My question is this.....any clean or neat way i can read japanese strings from the database and input them nicely into a reportlab table... -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Thu Jun 11 10:38:41 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 11 Jun 2009 11:38:41 -0300 Subject: [reportlab-users] PDF as image in reportlab redux Message-ID: <200906111138.41330.ralsina@netmanagers.com.ar> Is there a way I could get a copy of pagecatcher to add support for this in rst2pdf? I have absolutely no need for it, but if others can use it via rst2pdf, who knows, maybe you will sell a license because of it someday :-) -- ("\''/").__..-''"`-. . 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 paul.barrass at safeonlinebilling.com Thu Jun 11 10:52:08 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 11 Jun 2009 15:52:08 +0100 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> Message-ID: <4A311A18.7010907@safeonlinebilling.com> Michael Dorrian wrote: > I read data from the database and want to input it into a reportlab > table but i need to loop through the returned rows from my sql > statement and add rows to the table while doing so. The following > reportlab helper class is perfect for what i need but because i am > returning japanese strings this library comes back with errors. > http://code.google.com/p/podunk/ > > My question is this.....any clean or neat way i can read japanese > strings from the database and input them nicely into a reportlab table... Reportlab itself (since version 2) uses Unicode for strings, so should handle Japanese characters if passed in as Unicode (and provided the font has the appropriate characters). You'd need to ensure that the database was providing Unicode, and that the wrapper was passing it through. Without any details of the errors you're seeing, it'd be pretty difficult to find where the problem is occuring - but I doubt it would be in RL. Paul Barrass. From jwickard at gmail.com Thu Jun 11 12:38:34 2009 From: jwickard at gmail.com (Joel Wickard) Date: Thu, 11 Jun 2009 11:38:34 -0500 Subject: [reportlab-users] Text Background Message-ID: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> I have a line I'm drawing with canvas.line, that I want to place a text label in the middle of. If I use a text object, then the line and the text sort of co-mingle, I'm looking for the text to sort of clip the line out and create a white background / slight left & right padding. Anyone want to give me a starting direction on this? In the past using something like illustrator if I was doing this by hand I would have just created a white block behind the text as a separate object, I'm just checking to see if we have a different options with reportlab. -- Joel Wickard From ralsina at netmanagers.com.ar Thu Jun 11 12:41:47 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 11 Jun 2009 13:41:47 -0300 Subject: [reportlab-users] Text Background In-Reply-To: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> References: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> Message-ID: <200906111341.47560.ralsina@netmanagers.com.ar> On Thursday 11 June 2009 13:38:34 Joel Wickard wrote: > I have a line I'm drawing with canvas.line, that I want to place a > text label in the middle of. If I use a text object, then the line > and the text sort of co-mingle, I'm looking for the text to sort of > clip the line out and create a white background / slight left & right > padding. > > Anyone want to give me a starting direction on this? In the past > using something like illustrator if I was doing this by hand I would > have just created a white block behind the text as a separate object, > I'm just checking to see if we have a different options with > reportlab. I don't know if there is another option, but doing it that way should work in reportlab. -- ("\''/").__..-''"`-. . 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 paul.barrass at safeonlinebilling.com Thu Jun 11 12:48:46 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 11 Jun 2009 17:48:46 +0100 Subject: [reportlab-users] Text Background In-Reply-To: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> References: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> Message-ID: <4A31356E.4060101@safeonlinebilling.com> Joel Wickard wrote: > I have a line I'm drawing with canvas.line, that I want to place a > text label in the middle of. If I use a text object, then the line > and the text sort of co-mingle, I'm looking for the text to sort of > clip the line out and create a white background / slight left & right > padding. > > Anyone want to give me a starting direction on this? In the past > using something like illustrator if I was doing this by hand I would > have just created a white block behind the text as a separate object, > I'm just checking to see if we have a different options with > reportlab. > If you're trying to achieve what I think you are - you could use a white (or whatever background colour you're using) stroke and black (or whatever...) fill - this would (maybe, I've not tried it) create a white border around the characters which would overwrite the line, forming some padding. You'll need .setStrokeColor(colors.white) and .setTextRenderMode(3) [for stroke+fill] on the textObject. Alternatively, you could draw a white solid block 'between' the line and the text - there are method for working out the width of a string so you can set the box to the appropriate size. Paul Barrass. From gherman at darwin.in-berlin.de Thu Jun 11 12:54:49 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 11 Jun 2009 18:54:49 +0200 Subject: [reportlab-users] Text Background In-Reply-To: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> References: <3f0ccce00906110938p3eb89ab8me477f3b828ec460a@mail.gmail.com> Message-ID: <9CA902CC-C44C-46A5-AAC9-05BB5D2CE20D@darwin.in-berlin.de> Joel Wickard: > I have a line I'm drawing with canvas.line, that I want to place a > text label in the middle of. If I use a text object, then the line > and the text sort of co-mingle, I'm looking for the text to sort of > clip the line out and create a white background / slight left & right > padding. > > Anyone want to give me a starting direction on this? In the past > using something like illustrator if I was doing this by hand I would > have just created a white block behind the text as a separate object, > I'm just checking to see if we have a different options with > reportlab. You might also want to check this project of mine, which I've put on hold for a while, but it does what you want (if I understand correctly) on a paragraph level (many samples included): http://pypi.python.org/pypi/alterparagraphs Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From andy at reportlab.com Thu Jun 11 15:50:35 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 11 Jun 2009 20:50:35 +0100 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> Message-ID: <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> 2009/6/11 Michael Dorrian : > > My question is this.....any clean or neat way i can read japanese strings > from the database and input them nicely into a reportlab table... Can you send the traceback? We serve thousands of pages of Japanese PDFs each day from MySQL data; but I'm quite familiar with the many ways things can get misencoded before you get it working... 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 gherman at darwin.in-berlin.de Fri Jun 12 05:35:39 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 12 Jun 2009 11:35:39 +0200 Subject: [reportlab-users] Five issues with AreaLinePlot Message-ID: <3C08C2A9-5968-408D-A27D-0D894604855C@darwin.in-berlin.de> Hi, I've identified five issues with LineAreaPlots and attach sample code and output illustrating these. Here's a list from the code: # issue 1: gridline appears on top border, but not on bottom # border: (ideally, it should not appear on any borders) # issue 2: right borderline (red) is overpainted by chart areas: # issue 3: True/False has no effect (grid is always on top): # issue 4: True/False has no effect (labels are always shown, # if lineLabelFormat != None): # issue 5: label format cannot be a callable: # chart.lineLabelFormat = lambda val:"%s" % ("i" * val) I'd love to see tickets opened in a bug tracker for these issues and follow estimates and progress on their resolution, like in any decent community-aware project nowadays. Yes-I-know-I'm-asking-too-much-sigh'ly, Dinu -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arealineplot.py Type: text/x-python-script Size: 2396 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arealineplot.pdf Type: application/pdf Size: 3763 bytes Desc: not available Url : -------------- next part -------------- ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From michael.dorrian at gmail.com Fri Jun 12 05:45:32 2009 From: michael.dorrian at gmail.com (Michael Dorrian) Date: Fri, 12 Jun 2009 18:45:32 +0900 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> Message-ID: <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> Thanks for the replys........... Here is my function. I am just showing u what i had to do to display the first field of the table correctly from the returned rows of the sql.............there must be an easier way than this. The field headings display correctly. Its just the database data thats the problem. This table has a table style that uses the japanese font HeiseiMin-W3 font. Anyway if u could give me a some simpler way of doing this............ def getDomesticTable(ActNo): con = pymssql.connect(host="server", user="xx", password="xxxx", database="xxxx") #Get Cursor csr = con.cursor() styles = getSampleStyleSheet() query = "execute master.dbo.GetJPYFunds '%s'" % ActNo csr.execute(query) JPYRows = csr.fetchall() parstyle = ParagraphStyle(name='Notes', fontName='HeiseiMin-W3', fontSize=7,align='Center') t = Table(((u'????',u'?????',u'??',u'????',u'????',u'??',u'???',u'????',u'??',u'??'), (Paragraph(unicode(str(JPYRows[0][11]), 'shiftjis'),parstyle),100,200,300,400,100,200,300,400,300), ('Quarter 2',100,400,600,800,100,200,300,400,300), ('Quarter 3',100,200,300,800,100,200,300,400,300), #('Quarter 4',100,200,300,800), (None,None,None,'Total','1,200',None,900,900,None,None)), (72,92,36,38,38,38,36,38,36,30), (16, 19,16,16,18) ) #print title csr.close() con.close() return t On 6/12/09, Andy Robinson wrote: > 2009/6/11 Michael Dorrian : >> >> My question is this.....any clean or neat way i can read japanese strings >> from the database and input them nicely into a reportlab table... > > Can you send the traceback? > > We serve thousands of pages of Japanese PDFs each day from MySQL data; > but I'm quite familiar with the many ways things can get misencoded > before you get it working... > > 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 federico at panizzolo.it Fri Jun 12 06:04:55 2009 From: federico at panizzolo.it (Federico Fanton) Date: Fri, 12 Jun 2009 12:04:55 +0200 Subject: [reportlab-users] Printing on a dot matrix printer Message-ID: <4A322847.8050807@panizzolo.it> Hi everyone, I'm trying to print a PDF made with ReportLab on an Epson LX-300+, but the font ends up much smaller than on the print preview, and with a huge left margin.. The PDF is built using Platypus, with just a bunch of text Paragraphs with Courier font. I'm printing from Ubuntu 9.04 from Evince via CUPS, using the epsonc driver (recommended by openprinting.org) Are there known problems with PDFs on dot matrix printers? Is this supposed to work? Thanks for your time! From andy at reportlab.com Fri Jun 12 07:32:52 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 12 Jun 2009 12:32:52 +0100 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> Message-ID: <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> 2009/6/12 Michael Dorrian : > Thanks for the replys........... > Here is my function. I am just showing u what i had to do to display > the first field of the table correctly from the returned rows of the > sql.............there must be an easier way than this. The field > headings display correctly. Its just the database data thats the > problem. You said earlier that you get an error message when running this. Can you post the traceback? If it's in the table-building line, can you put this on a separate line....? str(..) requires its arguments to be ASCII, so whatever the content encoding is in JPYRows[0][11], if it contains any non-ascii, it will fail. Try getting the first field directly and converting it from utf8 to unicode on a separate line and then assembling it. We'll then know where it fails. e.g. db_content = JPYRows[0][11] unicode_content = db_content.decode('utf8') t = Table(Paragraphs(...headers..., (unicode_content, ....))) ...if that fails, try the other Japanese encodings in plave of 'utf8' - do you know anything about EUC or Shift-JIS? BTW, all those steps you are going through are necessary. If you are doing them in several parts of your program, you can hide them in a function somewhere to make it more readable; every project I work on tends to have a database connection already passed around, and I have a utility function something like this... def query(conn, sql_statement): cur = conn.cursor() cur.execute(sql_statement) rows = cur.fetchall() cur.close() #good idea with some DB APIs. return rows ...so the actual code I'd work on from project to project looks more like... table_data = [[headers]] + query(conn, 'SELECT blah blah....') t = Table(table_data) story.append(t) -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From michael.dorrian at gmail.com Fri Jun 12 07:38:29 2009 From: michael.dorrian at gmail.com (Michael Dorrian) Date: Fri, 12 Jun 2009 20:38:29 +0900 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> Message-ID: <9638c6950906120438t1ef6111dq55cc2cebfeb7d9eb@mail.gmail.com> Hi Andy,Thanks for this information. Sorry i didnt get an error when i just put the string in the table directly from sql queried returned rows but it displayed black squares instead of the japanese characters which was not correct..so in order to display the data correctly i encoded it in a paragrph and then nested it in the table...thanks for the tips....will try again and may ask for your help again if needed..but thanks very much for the response. Regards, Mike On Fri, Jun 12, 2009 at 8:32 PM, Andy Robinson wrote: > 2009/6/12 Michael Dorrian : > > Thanks for the replys........... > > Here is my function. I am just showing u what i had to do to display > > the first field of the table correctly from the returned rows of the > > sql.............there must be an easier way than this. The field > > headings display correctly. Its just the database data thats the > > problem. > > You said earlier that you get an error message when running this. Can > you post the traceback? If it's in the table-building line, can you > put this on a separate line....? > > > str(..) requires its arguments to be ASCII, so whatever the content > encoding is in JPYRows[0][11], if it contains any non-ascii, it will > fail. Try getting the first field directly and converting it from > utf8 to unicode on a separate line and then assembling it. We'll then > know where it fails. e.g. > > db_content = JPYRows[0][11] > unicode_content = db_content.decode('utf8') > t = Table(Paragraphs(...headers..., (unicode_content, ....))) > > > ...if that fails, try the other Japanese encodings in plave of 'utf8' > - do you know anything about EUC or Shift-JIS? > > > > > > BTW, all those steps you are going through are necessary. If you are > doing them in several parts of your program, you can hide them in a > function somewhere to make it more readable; every project I work on > tends to have a database connection already passed around, and I have > a utility function something like this... > > def query(conn, sql_statement): > cur = conn.cursor() > cur.execute(sql_statement) > rows = cur.fetchall() > cur.close() #good idea with some DB APIs. > return rows > > ...so the actual code I'd work on from project to project looks more > like... > > > table_data = [[headers]] + query(conn, 'SELECT blah blah....') > t = Table(table_data) > story.append(t) > > > -- > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Fri Jun 12 07:44:29 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 12 Jun 2009 12:44:29 +0100 Subject: [reportlab-users] Five issues with AreaLinePlot In-Reply-To: <3C08C2A9-5968-408D-A27D-0D894604855C@darwin.in-berlin.de> References: <3C08C2A9-5968-408D-A27D-0D894604855C@darwin.in-berlin.de> Message-ID: <956003ae0906120444k3b146c9er368bf18a27730a25@mail.gmail.com> 2009/6/12 Dinu Gherman : > I'd love to see tickets opened in a bug tracker for these issues > and follow estimates and progress on their resolution, like in any > decent community-aware project nowadays. Logged in the tracker as #1267. https://admin.reportlab.com/mantis/project/core/tracker/ As a decent community-aware project, doubtless someone will send in patches to fix these soon ;-) Failing that, when we block out time for release 2.4 we will attempt to tackle this and any other logged bugs in the tracker. - Andy From michael.dorrian at gmail.com Mon Jun 15 11:16:25 2009 From: michael.dorrian at gmail.com (Michael Dorrian) Date: Tue, 16 Jun 2009 00:16:25 +0900 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> Message-ID: <9638c6950906150816y7ef3cb28v6c72f9ef57782610@mail.gmail.com> Hi Andy,Thanks to your help i got this working. Below is the code that worked.Like you said using str() was a bad idea....but the main this is i was able to dynamically add my rows using a loop and also correctly decode the data to display correctly in the report. def query(conn, sql_statement): cur = conn.cursor() cur.execute(sql_statement) rows = cur.fetchall() cur.close() #good idea with some DB APIs. return rows table_data = [[headers]] JPYRows = query(conn, 'SELECT blah blah....') for col in JPYRows: firstCol = row[0].decode('shiftjis') secondCol = row[1].decode('shiftjis') ...... TenthCol = row[9].decode('shiftjis') table_data = [[firstCol,secondCol....TenthCol]] t = Table(table_data) story.append(t) I appreciated the help alot..Thanks :) Thanks, Mike On Fri, Jun 12, 2009 at 8:32 PM, Andy Robinson wrote: > 2009/6/12 Michael Dorrian : > > Thanks for the replys........... > > Here is my function. I am just showing u what i had to do to display > > the first field of the table correctly from the returned rows of the > > sql.............there must be an easier way than this. The field > > headings display correctly. Its just the database data thats the > > problem. > > You said earlier that you get an error message when running this. Can > you post the traceback? If it's in the table-building line, can you > put this on a separate line....? > > > str(..) requires its arguments to be ASCII, so whatever the content > encoding is in JPYRows[0][11], if it contains any non-ascii, it will > fail. Try getting the first field directly and converting it from > utf8 to unicode on a separate line and then assembling it. We'll then > know where it fails. e.g. > > db_content = JPYRows[0][11] > unicode_content = db_content.decode('utf8') > t = Table(Paragraphs(...headers..., (unicode_content, ....))) > > > ...if that fails, try the other Japanese encodings in plave of 'utf8' > - do you know anything about EUC or Shift-JIS? > > > > > > BTW, all those steps you are going through are necessary. If you are > doing them in several parts of your program, you can hide them in a > function somewhere to make it more readable; every project I work on > tends to have a database connection already passed around, and I have > a utility function something like this... > > def query(conn, sql_statement): > cur = conn.cursor() > cur.execute(sql_statement) > rows = cur.fetchall() > cur.close() #good idea with some DB APIs. > return rows > > ...so the actual code I'd work on from project to project looks more > like... > > > table_data = [[headers]] + query(conn, 'SELECT blah blah....') > t = Table(table_data) > story.append(t) > > > -- > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.barrass at safeonlinebilling.com Mon Jun 15 11:37:49 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Mon, 15 Jun 2009 16:37:49 +0100 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <9638c6950906150816y7ef3cb28v6c72f9ef57782610@mail.gmail.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> <9638c6950906150816y7ef3cb28v6c72f9ef57782610@mail.gmail.com> Message-ID: <4A366ACD.6020600@safeonlinebilling.com> Michael Dorrian wrote: > > for col in JPYRows: > firstCol = row[0].decode('shiftjis') > secondCol = row[1].decode('shiftjis') > ...... > TenthCol = row[9].decode('shiftjis') > table_data = [[firstCol,secondCol....TenthCol]] This would be slightly better expressed something like: for row in JPYRows: decoded_row=[col.decode('shiftjis') for col in row] table_data.append(decoded_row) which is easier to understand and will work in cases where you don't have exactly 10 columns of data.... Something I noticed with Andy's query function: def query(conn, sql_statement): cur = conn.cursor() cur.execute(sql_statement) is there's no way to pass parameters - I'm assuming that the query is built up fully in sql_statement, surely it would be better to pass a parameter-based query and the parameters, so that the DB API can escape/quote the various fields as required, rather than you having to remember to do so each time you use the query function or leave yourself open to an failed query, or worse an SQL injection attack if user input is accepted. Paul Barrass. From andy at reportlab.com Mon Jun 15 12:38:13 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 15 Jun 2009 17:38:13 +0100 Subject: [reportlab-users] Reportlab problem displaying japanese characters in a table In-Reply-To: <4A366ACD.6020600@safeonlinebilling.com> References: <9638c6950906110738u3aac821bpf1763131ac309f5@mail.gmail.com> <956003ae0906111250n54ec0076g6dde81c7a5662943@mail.gmail.com> <9638c6950906120245q6655be77v9e992e382f0d73be@mail.gmail.com> <956003ae0906120432i14b8e071p9342cf4f59b111e0@mail.gmail.com> <9638c6950906150816y7ef3cb28v6c72f9ef57782610@mail.gmail.com> <4A366ACD.6020600@safeonlinebilling.com> Message-ID: <956003ae0906150938k16374757t8d074aba6dc9b5cd@mail.gmail.com> 2009/6/15 Paul Barrass : > Something I noticed with Andy's query function: > > def query(conn, sql_statement): > ?cur = conn.cursor() > ?cur.execute(sql_statement) > > is there's no way to pass parameters I normally have a '*args' argument for this reason, but guessed the poster was fairly new to Python so wanted to keep it simple. - Andy From moshe.wagner at gmail.com Mon Jun 8 04:42:43 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Mon, 8 Jun 2009 11:42:43 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A283069.5070902@probo.com> <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> Message-ID: Well, I believe I fixed the system dealing with mixed texts. The problem was that fribidi must have a base direction given for any line. For instance, the line "hello world!", will stay intact when given to fribidi if the base direction is LTR, but should become "!hello world", if the base direction is RTL, since we want to look at it as part of a RTL paragraph, and therefore the end of the line is on the left. Until now, I used fribidi's auto detection for the base direction, but since I did it for every line separately, it would treat a line like the one I gave above always as LTR, ignoring the fact that it's in a RTL paragraph. The new code deals with that now by determining the base direction by the alignment type of the paragraph, and giving it to all lines in the paragraph. The only problem is with filled paragraphs, where the base direction can't be determined, since it still could be either RTL or LTR. The best solution is to allow two types of filled alignments, FILL_LEFT, and FILL_RIGHT, which is needed anyway for positioning the last line correctly, as I mentioned before. Could that be done? Anyway, until that could be done, I made the code use fribidi's auto detection for the base direction of filled paragraphs, so it's decided by there first character. It isn't ideal, but it works. So here is the new code: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line separately. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" else: #First, the base direction given to pyfribidi must be decided. # In justified paragraphs, it's decided by their alignment. # For now, there is only one type of fill justified paragraphs. # So even though it acts like a left justified one, # we cannot assume that's the alignment the text should have. # So the direction is guessed by the first character of the text. if self.style.alignment == TA_LEFT: direction = pyfribidi.LTR elif self.style.alignment == TA_RIGHT: direction = pyfribidi.RTL else: # Get first character of the text: c = "" if isinstance(blPara.lines[0], (FragLine, ParaLines)): c = blPara.lines[0].words[0].text[0] + blPara.lines[0].words[0].text[1] elif isinstance(blPara.lines[0], tuple): c = blPara.lines[0][1][0] + blPara.lines[0][1][1] #Guess direction by it: direction = self.guessBaseDirection(c) for line in blPara.lines: if isinstance(line, (FragLine, ParaLines)): #When the line is a FragLine or ParaLines, Its #text attribute of each of it's words is flipped. #Then, the order of the words is flipped too, #So that 2 word parts on the same line #will be in the right order for word in line.words: word.text = pyfribidi.log2vis(word.text,direction) line.words.reverse() elif isinstance(line, tuple): #When the line is just a tuple whose second value is the text. #since I coulden't directly change it's value, #it's done by merging the words, flipping them, #and re-entering them one by one to the second attribute """ s = ' '.join(line[1]) s = pyfribidi.log2vis(s,direction) line[1][:] = s.split() else: print line.__class__.__name__ ###################### And this function should be added before the 'wrap' function in the same class: ############################### # Guesses the direction the given text should have (LTR or RTL), for cases where it can't be decided by it's alignment def guessBaseDirection(self, s): # Since pyfribidi doesn't have an option to return fribidi's guess, # I have to find out it's guess in a very ugly way # This adds a neutral sign to the given text. # Then the text is mirrored, letting fribidi to guess it's direction. # If it's RTL text, the added sign will now become the first character of the text, # While if it's LTR the sign will stay at the end. import pyfribidi s += '.' s = pyfribidi.log2vis(s,pyfribidi.ON) if (s[0] == "."): return pyfribidi.RTL else: return pyfribidi.LTR ############################### Moshe Another point I got wrong is that pyfribidi *DOES* require fribidi itself, not like I said before. On Sun, Jun 7, 2009 at 2:12 PM, Moshe Wagner wrote: > Looking at my test again, I see there is still a bug with mixed texts. > I'll update when I fix it. > > Moshe > > On Sun, Jun 7, 2009 at 2:09 PM, Moshe Wagner wrote: >> Well, I'm not a really great technical writer either, and I'm not >> really sure how much background you want. But I'll give the best >> description I can think of. As I said, feel free to change anything so >> it meets your requirements, or ask me to give more information on any >> point you think I didn't get into enough. >> >> (Note: I don't know enough about any other languages, so I'm strictly >> speaking about Hebrew. Arabic, for instance, is very similar in terms >> of being RTL, but has a few very different properties, such as joined >> letters. I do believe fribidi deals with that correctly, and therefore >> my patch should add Arabic support too, but I cannot promise that. Is >> there anyone who can test this? ?) >> >> Displaying Hebrew - >> >> First step for displaying any non ASCII characters, and therefore >> Hebrew as well, is obtaining a font containing it's characters. I >> didn't check all of the default PDF fonts, but those I did, did not >> include Hebrew glyphs. >> Instead, I use fonts from the Culmus project (http://culmus.sourceforge.net). >> ( In the test archive I included one font from there, and it's license >> file. I hope that's ok) >> >> >> 'Visual' and 'Logical' ordering - >> >> Once a font with the characters is used, single Hebrew characters can >> be displayed, but the words will still come out mirrored, as I'll >> explain. >> Say we take the word hello, that is, "????" ("Shalom"). If you see it >> correctly, you will see the character "?" at the most right part of >> that word, as it's the first letter, and Hebrew is read from right to >> left. >> But if we would look at the word as an array of chars, 'c_str', the >> values would be: >> c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?". >> >> So when printed from left to right, as is usually done, the word will >> be shown as: >> "????", >> since the characters are printed by their real order (called >> 'logical'), but start from the wrong side. >> >> To avoid this, a 'visual' ordering is used instead of the 'logical' one. >> So the word "????" will be stored as - >> c_str[0] = "?", c_str[1] = "?", c_str[2] = "?" and c_str[3]="?", so >> when printed from left to right, it will be displayed as >> "????" - which is the correct order. >> >> The visual ordering must be used carefully, though, since when >> printing text that's split along a few lines, it will cause their >> order to switch too, as mirroring affects both axises. >> ( i.e, "???? ???", when each word is op a separate line, will be >> ???? >> ??? >> In logical ordering, >> and: >> ??? >> ???? >> ?In visual, which are both wrong.) >> The solution is to mirror every line on it's own, but that must be >> done in the wrapping function, but not before or after it. >> >> >> Fribidi and Pyfribidi - >> >> A library allowing to convert between 'logical' and 'visual' ordering, >> while testing if the text is RTL before mirroring it, and supporting >> mixed texts, where only the RTL part should be mirrored, is fribidi - >> "An implementation of the Unicode Bidirectional Algorithm (bidi)." - >> http://fribidi.org/. >> >> The python binding for this library is called pyfribidi - >> http://pyfribidi.sourceforge.net/ . (It does not require fribidi >> itself installed.) >> All versions of pyfribidi should work fine, but I suppose the newest >> version should always be used. >> >> My code - >> My code simply uses pyfribidi to add RTL (and mixed LTR and RTL >> strings) support to reportlab. >> In "canvas.py" it simply runs 'pyfribidi.log2vis' on the text, while >> in "paragraph.py" it does it to each line seperatly. >> >> This is I have added to the "canvas.py" file, right at the beginning >> of the "drawString" function: >> ###################### >> # Hebrew text patch, Moshe Wagner, June 2009 >> # >> >> # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) >> # If it could not be imported, it does nothing >> # Plain LTR texts will not be affected in any case. >> try: >> ? ? ? ?import pyfribidi >> ? ? ? ?text = pyfribidi.log2vis(text,base_direction=pyfribidi.ON) >> >> except ImportError: >> ? ? ? ?import sys >> ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL >> support for this paragraph" >> ##################### >> >> And this is what I added to "paragraph.py", in the "wrap" function, >> right after the call to "self.breakLines": >> ###################### >> # Hebrew text patch, Moshe Wagner, June 2009 >> # >> >> #This code fixes paragraphs with RTL text >> >> # It does it by flipping each line seperatly. >> # ? ? ? (Depending on the type of the line) >> >> # If fribidi cant be imported, it does nothing >> # Plain LTR texts will not be affected in any case. >> >> try: >> ? ? ? ?import pyfribidi >> except ImportError: >> ? ? ? ?import sys >> ? ? ? ?print >> sys.stderr, "Fribidi module not found; You will not have RTL >> support for this paragraph" >> else: >> ? ? ? ?for line in blPara.lines: >> ? ? ? ?if isinstance(line, (FragLine, ParaLines)): >> ? ? ? ? ? ? ? ?#When the line is a FragLine or ParaLines, Its >> ? ? ? ? ? ? ? ?#text attribute of each of it's words is flipped. >> ? ? ? ? ? ? ? ?#Then, the order of the words is flipped too, >> ? ? ? ? ? ? ? ?#So that 2 word parts on the same line >> ? ? ? ? ? ? ? ?#will be in the right order >> ? ? ? ? ? ? ? ?for word in line.words: >> ? ? ? ? ? ? ? ?word.text = pyfribidi.log2vis(word.text, base_direction=pyfribidi.ON) >> >> ? ? ? ? ? ? ? ?line.words.reverse() >> >> ? ? ? ?elif isinstance(line, tuple): >> ? ? ? ? ? ? ? ?#When the line is just a tuple whose second value is the text. >> ? ? ? ? ? ? ? ?#since I coulden't directly change it's value, >> ? ? ? ? ? ? ? ?#it's done by merging the words, flipping them, >> ? ? ? ? ? ? ? ?#and re-entering them one by one to the second attribute """ >> >> ? ? ? ? ? ? ? ?s = ' '.join(line[1]) >> ? ? ? ? ? ? ? ?s = pyfribidi.log2vis( s, base_direction=pyfribidi.ON) >> ? ? ? ? ? ? ? ?line[1][:] = s.split() >> ? ? ? ?else: >> ? ? ? ? ? ? ? ?print line.__class__.__name__ >> ###################### >> >> >> >> I attached an archive containing a Hebrew font, and a test script. >> The script should test all cases I know that my patch should deal >> with, and adds an image of good results for comparison. >> >> Moshe >> >> >> On Fri, Jun 5, 2009 at 4:37 PM, Andy Robinson wrote: >>> 2009/6/5 Moshe Wagner : >>>> Is there any chance this could be added to the official code? >>> >>> Moshe, thanks very much for your contribution. ?We're happy in >>> principle to add this kind of patch but it would help a great deal if >>> you could produce two more things... >>> >>> (a) a suitable few paragraphs for us to put in a Whats New page or the >>> user guide. ?Mention what pyfribidi is, what version is needed (if it >>> matters) and where to get it. ?Also mention what one needs to install >>> to view these things - do we need special fonts, Acrobat Language >>> packs etc..? ? Assume the reader knows nothing about RTL. ? ? Just >>> send text to me or the list and I'll add it to the docs and/or web >>> site. >>> >>> (b) most important of all, a small test script (see our 'tests' >>> folder) which generates some Hebrew and/or Arabic output, which we can >>> run and look at. ? The absolute ideal test script would have a bitmap >>> of the correct Hebrew to look at, and say "the text below should look >>> like the above", since I at least would not know if it was backwards >>> or forwards ;-) >>> >>> Most people in ReportLab are too busy to have been following this in >>> detail but we'd really welcome any improvement in this area. We are >>> also starting from zero knowledge of Hebrew and Arabic - unlike Asian >>> text which we deal with daily. ?There will be a release in a few weeks >>> and this would be a very valuable addition... >>> >>> 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 >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: Report Lab RTL Test.tar.gz Type: application/x-gzip Size: 100254 bytes Desc: not available Url : From moshe.wagner at gmail.com Mon Jun 8 14:45:26 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Mon, 8 Jun 2009 21:45:26 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <4A2D46D0.2090008@chamonix.reportlab.co.uk> References: <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> Message-ID: OK, I'll try to make things a bit clearer. First - fribidi (and therefor pyfribidi) is an "implementation of the Unicode Bidirectional Algorithm (bidi)." This 'Unicode Bidirectional Algorithm' does not apply to RTL texts only. It applies to all text what so ever. The real correct way to display *any* text, just in case it *might* have any RTL characters, is to apply this algorithm to it. So, ideally, my patch should not have any affect to users using only LTR text, even if they have pyfribidi installed, and the algorithm is applied to all texts. But, there is one case where using the algorithm correctly might cause problems. When a paragraph is aligned to the right, even LTR text *should* be treated as if they are part of an RTL paragraph, and therefor any sign at the end of the line, i.e. periods, should be at the left, which is actually the line's real end (Since the paragraph starts from the right). This may be the correct thing, but it's probably not what the users expect. ( In any case, this will not happen if pyfribidi isn't installed, so it isn't so bad. ) I could disable this of course, and tell it to treat any paragraph as an LTR one, but that will not be the right behavior for RTL or mixed texts. So it might actually make sense to use a special RTL type for RTL paragraphs, so that when it is given, the algorithm will be used correctly. And since anyway, as I said, we need a way to determine the type of the paragraph for the last line of fill justified paragraphs (deciding whether it should be at the left or the right), this might be a even better idea. Is this the method I should go for? Anyway, all that shouldn't cause any problems in the single line displaying, since there the direction of the text is decided by the first characters of the text, and not by the alignment. Moshe To make things clearer I attached the latest test archive, and here is the whole latest patch: This function should be added to to "paragraph.py" before the 'wrap' function, but in the same class: ############################### # Guesses the direction the given text should have (LTR or RTL), for cases where it can't be decided by it's alignment def guessBaseDirection(self, s): # Since pyfribidi doesn't have an option to return fribidi's guess, # I have to find out it's guess in a very ugly way # This adds a neutral sign to the given text. # Then the text is mirrored, letting fribidi to guess it's direction. # If it's RTL text, the added sign will now become the first character of the text, # While if it's LTR the sign will stay at the end. import pyfribidi s += '.' s = pyfribidi.log2vis(s,pyfribidi.ON) if (s[0] == "."): return pyfribidi.RTL else: return pyfribidi.LTR ############################### And this should be added to the "wrap" function, right after the call to "self.breakLines": ###################### # Hebrew text patch, Moshe Wagner, June 2009 # #This code fixes paragraphs with RTL text # It does it by flipping each line separately. # (Depending on the type of the line) # If fribidi cant be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" else: #First, the base direction given to pyfribidi must be decided. # In justified paragraphs, it's decided by their alignment. # For now, there is only one type of fill justified paragraphs. # So even though it acts like a left justified one, # we cannot assume that's the alignment the text should have. # So the direction is guessed by the first character of the text. if self.style.alignment == TA_LEFT: direction = pyfribidi.LTR elif self.style.alignment == TA_RIGHT: direction = pyfribidi.RTL else: # Get first character of the text: c = "" if isinstance(blPara.lines[0], (FragLine, ParaLines)): if len(blPara.lines[0].words[0].text) < 2: #This must be English, because Unicode chars take up 2 spaces in the array direction = pyfribidi.LTR else: c = blPara.lines[0].words[0].text[0] + blPara.lines[0].words[0].text[1] elif isinstance(blPara.lines[0], tuple): if len(blPara.lines[0][1]) < 2: #This must be English, because Unicode chars take up 2 spaces in the array direction = pyfribidi.LTR else: c = blPara.lines[0][1][0] + blPara.lines[0][1][1] #Guess direction by it: direction = self.guessBaseDirection(c) for line in blPara.lines: if isinstance(line, (FragLine, ParaLines)): #When the line is a FragLine or ParaLines, Its #text attribute of each of it's words is flipped. #Then, the order of the words is flipped too, #So that 2 word parts on the same line #will be in the right order for word in line.words: word.text = pyfribidi.log2vis(word.text,direction) line.words.reverse() elif isinstance(line, tuple): #When the line is just a tuple whose second value is the text. #since I coulden't directly change it's value, #it's done by merging the words, flipping them, #and re-entering them one by one to the second attribute """ s = ' '.join(line[1]) s = pyfribidi.log2vis(s,direction) line[1][:] = s.split() else: print line.__class__.__name__ ###################### And this is added to the "canvas.py" file, right at the beginning of the "drawString" function: ###################### # Hebrew text patch, Moshe Wagner, June 2009 # # Flips the given text with pyfribidi, if it's needed (i.e. Hebrew or Arabic) # If it could not be imported, it does nothing # Plain LTR texts will not be affected in any case. try: import pyfribidi text = pyfribidi.log2vis(text,base_direction=pyfribidi.ON) except ImportError: import sys print >> sys.stderr, "Fribidi module not found; You will not have RTL support for this paragraph" ##################### -------------- next part -------------- A non-text attachment was scrubbed... Name: Report Lab RTL Test.tar.gz Type: application/x-gzip Size: 100254 bytes Desc: not available Url : From andy at reportlab.com Wed Jun 17 07:42:39 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 17 Jun 2009 12:42:39 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <956003ae0906050637j459ab958yd941a28a0b7e87ca@mail.gmail.com> <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> Message-ID: <956003ae0906170442l53cb0096iab6502f643a2d7ce@mail.gmail.com> > Is this the method I should go for? Unfortunately we're lagging behind you and have yet to get your code running, and it's hard to give an answer just yet. I spent a long evening battling to compile pyfribidi and fribidi and failed, although a colleague claims to have done it; then things got busy. I hope by the end of this week we'll have working built copies of pyfribidi for the platforms we work on (we have ubuntu/mac/windows in the office), and then can put some effort into the behaviour with you. -- Andy From moshe.wagner at gmail.com Wed Jun 17 09:12:49 2009 From: moshe.wagner at gmail.com (Moshe Wagner) Date: Wed, 17 Jun 2009 16:12:49 +0300 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: <956003ae0906170442l53cb0096iab6502f643a2d7ce@mail.gmail.com> References: <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> <956003ae0906170442l53cb0096iab6502f643a2d7ce@mail.gmail.com> Message-ID: OK, fine. About compiling fribidi and pyfribidi: On Ubuntu both have binary versions in the official repositories, so that shouldn't be a problem. As for windows, I tried compiling fribidi on it in the past, and it wasn't so simple. If I recall correctly, I succeeded eventually using the mingw tools. Moshe On Wed, Jun 17, 2009 at 2:42 PM, Andy Robinson wrote: >> Is this the method I should go for? > > Unfortunately we're lagging behind you and have yet to get your code > running, and it's hard to give an answer just yet. > > I spent a long evening battling to compile pyfribidi and fribidi and > failed, although a colleague claims to have done it; then things got > busy. ?I hope by the end of this week we'll have working built copies > of pyfribidi for the platforms we work on (we have ubuntu/mac/windows > in the office), and then can put some effort into the behaviour with > you. > > -- > Andy > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From andy at reportlab.com Wed Jun 17 11:47:11 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 17 Jun 2009 16:47:11 +0100 Subject: [reportlab-users] Hebrew Support Patch In-Reply-To: References: <4A2D36EB.1020300@chamonix.reportlab.co.uk> <956003ae0906080958v9a7fd77n8061a50f5fc7080a@mail.gmail.com> <4A2D46D0.2090008@chamonix.reportlab.co.uk> <956003ae0906170442l53cb0096iab6502f643a2d7ce@mail.gmail.com> Message-ID: <956003ae0906170847r698d8d43u69d1b998eac9011f@mail.gmail.com> 2009/6/17 Moshe Wagner : > OK, fine. > > About compiling fribidi and pyfribidi: On Ubuntu both have binary > versions in the official repositories, so that shouldn't be a problem. Thanks! I didn't find them on my jaunty machine but looking again they are there for hardy, so probably it's just a time lag. For anyone else needing them the packages are... "python-pyfribidi" and "libfribidi0" I dare say we can built a Windows one and put it up for others. Will play with this some more tonight... - Andy From cwurld at yahoo.com Wed Jun 17 12:37:10 2009 From: cwurld at yahoo.com (Chuck Martin) Date: Wed, 17 Jun 2009 09:37:10 -0700 (PDT) Subject: [reportlab-users] Problem w Image Flowable Message-ID: <347234.59993.qm@web111402.mail.gq1.yahoo.com> Hi, I am trying to add an image using the Image flowable. I make a frame. Then I make a list of flowables, with the image flowable at the end of the list, the I used the addFromList method to insert the flowables into the frame. When the the paragraphs are short, the image is drawn with quite a bit of space remaining in the frame (this is what I expected). But when the prior paragraphs get a little longer, then image is not drawn, even though there is plenty of space for it. The Image.wrap method is returning the correct size. When I put some print statements in the reportlab code, I see that wrap is being called for this flowable, but the draw method is not. I have tried various settings of "lazy" and it has no effect. I have tried putting a text paragraph after the Image and that has no effect (and the text is not drawn). Overall, it looks like reportlab is incorrectly determining that there is not enough room in the frame so it is not drawing the image. Does anyone have any suggestions? Thanks, Chuck From cwurld at yahoo.com Wed Jun 17 13:00:51 2009 From: cwurld at yahoo.com (Chuck Martin) Date: Wed, 17 Jun 2009 10:00:51 -0700 (PDT) Subject: [reportlab-users] Problem w Image Flowable In-Reply-To: <347234.59993.qm@web111402.mail.gq1.yahoo.com> References: <347234.59993.qm@web111402.mail.gq1.yahoo.com> Message-ID: <908567.42095.qm@web111409.mail.gq1.yahoo.com> Hi All, Please disregard this message. It turns out I had a typo in my frame bottomPadding. Sorry, Chuck ----- Original Message ---- From: Chuck Martin To: reportlab-users at reportlab.com Sent: Wednesday, June 17, 2009 11:37:10 AM Subject: [reportlab-users] Problem w Image Flowable Hi, I am trying to add an image using the Image flowable. I make a frame. Then I make a list of flowables, with the image flowable at the end of the list, the I used the addFromList method to insert the flowables into the frame. When the the paragraphs are short, the image is drawn with quite a bit of space remaining in the frame (this is what I expected). But when the prior paragraphs get a little longer, then image is not drawn, even though there is plenty of space for it. The Image.wrap method is returning the correct size. When I put some print statements in the reportlab code, I see that wrap is being called for this flowable, but the draw method is not. I have tried various settings of "lazy" and it has no effect. I have tried putting a text paragraph after the Image and that has no effect (and the text is not drawn). Overall, it looks like reportlab is incorrectly determining that there is not enough room in the frame so it is not drawing the image. Does anyone have any suggestions? Thanks, Chuck _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From gtaylor at clemson.edu Wed Jun 17 16:56:45 2009 From: gtaylor at clemson.edu (Greg Taylor) Date: Wed, 17 Jun 2009 16:56:45 -0400 Subject: [reportlab-users] Spot Colors (spotName) + PDF Message-ID: <8de369d70906171356v3b5ecce6k2adad732d21c110@mail.gmail.com> Hello all, After much digging for some solid information on the state of Reportlab's spot color support, I came up empty aside from a very old post: http://osdir.com/ml/python.reportlab.user/2003-11/msg00048.html I wanted to see if there had been any progress made in regards to supporting arbitrary spot colors in PDFs generated by Reportlab. I saw mention of this being possible with EPS, but we're a strictly PDF shop. We're considering replacing some ancient PDFLib (commercial) driven software with Reportlab, but this is an absolute show stopper at this point. PDFLib handled spot colors by letting you define a spot color as a name, and provide CMYK values for what it will be rendered as in an editor. Spot colors typically only really matter in commercial or flexographic printing, and their colors are defined by the inks they put in the press (spot colors that are designed to replace CMYK combinations). The appearance in any editor/viewer (the CMYK value you can assign to the spot color) is completely arbitrary and not at all important on the printing press. It would also be illegal to enter some of the commercial spot color CMYK approximations, as that may not be done without permission from Pantone and etc. Sorry for the long post. We tried to get this working a few times, but it still looks like the spot colors are being converted to straight CMYK colors (rather than a separate, named ink). Any help would be greatly appreciated! Greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Wed Jun 17 17:41:32 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 17 Jun 2009 22:41:32 +0100 Subject: [reportlab-users] Spot Colors (spotName) + PDF In-Reply-To: <8de369d70906171356v3b5ecce6k2adad732d21c110@mail.gmail.com> References: <8de369d70906171356v3b5ecce6k2adad732d21c110@mail.gmail.com> Message-ID: <956003ae0906171441w448ac032rc8fdc989c1f5d1d8@mail.gmail.com> 2009/6/17 Greg Taylor : > Hello all, > > I wanted to see if there had been any progress made in regards to supporting > arbitrary spot colors in PDFs generated by Reportlab. I saw mention of this > being possible with EPS, but we're a strictly PDF shop. > > We're considering replacing some ancient PDFLib (commercial) driven software > with Reportlab, but this is an absolute show stopper at this point. PDFLib > handled spot colors by letting you define a spot color as a name, and > provide CMYK values for what it will be rendered as in an editor. We have actually done our first experiments on generating spot color PDF for another client a month ago, which passed all the needed tests. (We have the color classes to hold the info, but use it in our commercial EPS back end, as we've been helping companies generate spot color EPS charts for years). However, it's the kind of thing we might choose to put in our commercial package rather than our open source one - no decision has been made yet. I'll email you directly on this shortly. 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 samukham.inf at gmail.com Thu Jun 18 01:34:52 2009 From: samukham.inf at gmail.com (sudhakar samukham) Date: Thu, 18 Jun 2009 11:04:52 +0530 Subject: [reportlab-users] open pdf Message-ID: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> Hi everyone, I generated pdf using reportlab,upto here its ok, the pdf is generated at specified location but when want see the output in pdf ,I need to go the specified location then open it manually by clicking on pdf. Here what i need is that when i run my script the pdf should open automatically instead of not doing any manual opening. Thanks in advance. With regards S Sudhakar. -------------- next part -------------- An HTML attachment was scrubbed... URL: From samukham.inf at gmail.com Thu Jun 18 02:24:12 2009 From: samukham.inf at gmail.com (Sudhakar Samukham) Date: Thu, 18 Jun 2009 02:24:12 -0400 Subject: [reportlab-users] Sudhakar Samukham sent you a Friend Request on Yaari Message-ID: <59a4fccb9bf855ee45dafc861c567586@localhost.localdomain> Sudhakar Samukham wants you to join Yaari! Is Sudhakar your friend? Yes, Sudhakar is my friend! No, Sudhakar isn't my friend. Please respond or Sudhakar may think you said no :( Thanks, The Yaari Team ----------------------------------------------------------- Yaari Inc., 358 Angier Ave NE Atlanta, GA 30312 Privacy Policy | Unsubscribe | Terms of Service YaariHAL668EOV346XDE256GBT433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Thu Jun 18 05:27:56 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 18 Jun 2009 10:27:56 +0100 Subject: [reportlab-users] open pdf In-Reply-To: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> Message-ID: <4A3A089C.8030303@chamonix.reportlab.co.uk> sudhakar samukham wrote: > Hi everyone, > > I generated pdf using reportlab,upto here its ok, > the pdf is generated at specified location but when > want see the output in pdf ,I need to go the specified > location then open it manually by clicking on pdf. > > Here what i need is that when i run my script the pdf should > open automatically instead of not doing any manual opening. > > Thanks in advance. > > With regards > S Sudhakar. > ....... This looks more like a problem for the python list. Depending on your operating system what the script needs to do is something like os.system("acrord "+pdfFilePath) #linux or os.system("start "+pdfFilePath) #windows somewhere after the pdf file is created and the file closed. The windows version definitely detaches from the current process so that the script can continue. -- Robin Becker From henning.vonbargen at arcor.de Thu Jun 18 05:31:17 2009 From: henning.vonbargen at arcor.de (Henning von Bargen) Date: Thu, 18 Jun 2009 11:31:17 +0200 Subject: [reportlab-users] open pdf In-Reply-To: References: Message-ID: <4A3A0965.8000602@arcor.de> os.startfile("file.pdf") From andy at reportlab.com Thu Jun 18 05:37:52 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 18 Jun 2009 10:37:52 +0100 Subject: [reportlab-users] open pdf In-Reply-To: <4A3A089C.8030303@chamonix.reportlab.co.uk> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> <4A3A089C.8030303@chamonix.reportlab.co.uk> Message-ID: <956003ae0906180237t7b3297d0x156f5aac8cb0fb44@mail.gmail.com> 2009/6/18 Robin Becker : > sudhakar samukham wrote: > This looks more like a problem for the python list. Depending on your > operating system what the script needs to do is something like > > os.system("acrord "+pdfFilePath) ? ? ? ?#linux > > or > > os.system("start "+pdfFilePath) ? ? ? ? #windows The first one assumes you've installed acroread, which, being non-free, requires a couple of extra steps; evince may be better as it's in Ubuntu and other distros. os.system("acroread "+pdfFilePath) #linux if you installed acroread os.system("evince "+pdfFilePath) #linux (Ubuntu lightweight viewer, installed by default) On Mac it should be this, which will use whatever viewer app you have configured. os.system("open "+pdfFilePath) #mac - Andy From damian at reportlab.com Thu Jun 18 06:02:23 2009 From: damian at reportlab.com (Damian Moore) Date: Thu, 18 Jun 2009 11:02:23 +0100 Subject: [reportlab-users] open pdf In-Reply-To: <956003ae0906180237t7b3297d0x156f5aac8cb0fb44@mail.gmail.com> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> <4A3A089C.8030303@chamonix.reportlab.co.uk> <956003ae0906180237t7b3297d0x156f5aac8cb0fb44@mail.gmail.com> Message-ID: <1245319343.20412.5.camel@fuji> On Thu, 2009-06-18 at 10:37 +0100, Andy Robinson wrote: > os.system("acroread "+pdfFilePath) #linux if you installed acroread > os.system("evince "+pdfFilePath) #linux (Ubuntu lightweight > viewer, installed by default) This will use the system default application on linux and other unix-like desktops which follow free desktop standards: os.system("xdg-open "+pdfFilePath) From ralsina at netmanagers.com.ar Thu Jun 18 06:26:48 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 18 Jun 2009 07:26:48 -0300 Subject: [reportlab-users] open pdf In-Reply-To: <4A3A089C.8030303@chamonix.reportlab.co.uk> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> <4A3A089C.8030303@chamonix.reportlab.co.uk> Message-ID: <200906180726.49727.ralsina@netmanagers.com.ar> On Thursday 18 June 2009 06:27:56 Robin Becker wrote: > sudhakar samukham wrote: > > Hi everyone, > > > > I generated pdf using reportlab,upto here its ok, > > the pdf is generated at specified location but when > > want see the output in pdf ,I need to go the specified > > location then open it manually by clicking on pdf. > > > > Here what i need is that when i run my script the pdf should > > open automatically instead of not doing any manual opening. > > > > Thanks in advance. > > > > With regards > > S Sudhakar. > > ....... > This looks more like a problem for the python list. Depending on your > operating system what the script needs to do is something like > > os.system("acrord "+pdfFilePath) #linux If there is a xdg-open program in the PATH, it's probably better to use it, since there's no guarantee the user has acroread installed (could be using okular, xpdf, evince, whatever) > > or > > os.system("start "+pdfFilePath) #windows > > > somewhere after the pdf file is created and the file closed. The windows > version definitely detaches from the current process so that the script can > continue. -- ("\''/").__..-''"`-. . 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 Thu Jun 18 13:09:49 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 18 Jun 2009 10:09:49 -0700 Subject: [reportlab-users] open pdf In-Reply-To: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> Message-ID: <4A3A74DD.9020208@probo.com> sudhakar samukham wrote: > > I generated pdf using reportlab,upto here its ok, > the pdf is generated at specified location but when > want see the output in pdf ,I need to go the specified > location then open it manually by clicking on pdf. > > Here what i need is that when i run my script the pdf should > open automatically instead of not doing any manual opening. Which operating system? On Windows, you can just say: os.system( "start c:\\path\\to\\file\\document.pdf" ) or subprocess.Popen( 'c:\\path\\to\\file\\document.pdf' ) Remember, however, that your script cannot overwrite the file while Acrobat has it open. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From niki.spahiev at gmail.com Fri Jun 19 10:58:30 2009 From: niki.spahiev at gmail.com (Niki Spahiev) Date: Fri, 19 Jun 2009 17:58:30 +0300 Subject: [reportlab-users] open pdf In-Reply-To: <4A3A74DD.9020208@probo.com> References: <3fbeaca30906172234q49414b30s2b9c9670324784e5@mail.gmail.com> <4A3A74DD.9020208@probo.com> Message-ID: <4A3BA796.3020105@gmail.com> Tim Roberts wrote: > sudhakar samukham wrote: >> I generated pdf using reportlab,upto here its ok, >> the pdf is generated at specified location but when >> want see the output in pdf ,I need to go the specified >> location then open it manually by clicking on pdf. >> >> Here what i need is that when i run my script the pdf should >> open automatically instead of not doing any manual opening. > > Which operating system? On Windows, you can just say: > os.system( "start c:\\path\\to\\file\\document.pdf" ) > or > subprocess.Popen( 'c:\\path\\to\\file\\document.pdf' ) use os.startfile on windows Niki From ralsina at netmanagers.com.ar Fri Jun 19 18:10:34 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 19 Jun 2009 19:10:34 -0300 Subject: [reportlab-users] Announce: rst2pdf 0.11 is out Message-ID: <200906191910.34894.ralsina@netmanagers.com.ar> It's my pleasure to announce the release of rst2pdf version 0.11, available at http://code.google.com/p/rst2pdf/downloads/list Rst2pdf is a tool to generate PDF files directly from restructured text sources via reportlab. This version includes many bugfixes and some new features compared to the previous 0.10.1 version, including but not limited to embedding PDF images, much improved image sizing, nicer list layouts, better styling, page backgrounds, and more than 15 bugs fixed. A full changelog is included at the bottom of this message. Rst2pdf aims to support the full restructured text feature set, and is very close to that goal, while also including some of the more experimental features, like a source code directive with syntax highlighting and math notation support with LaTeX-like syntax. It supports embedding arbitrary fonts, both True Type and PS Type 1, both raster and vector images (including SVG), page transition effects, multiple, flexible page layouts, cascading styles, and much, much more. You can find more information about rst2pdf in its home page ( http://rst2pdf.googlecode.com), and ask anything you want in the rst2pdf- discuss mailing list (http://groups.google.com/group/rst2pdf-discuss) Here are the changes in this version compared to 0.10.1: * Degrade more gracefully when one or more wordaxe hyphenators are broken (currently DWC is the broken one) * Fixed issue 132: in some cases, with user-defined fontAlias, bold and italic would get confused (getting italic instead of bold in inline markup, for instance). * New stylesheet no-compact-lists to make lists... less compact * SVG images now handle % as a width unit correctly. * Implemented issue 127: support images in PDF format. Right now they are rasterized, so it's not ideal. Perhaps something better will come up later. * Fixed issue 129: make it work around a prblem with KeepTogether in RL 2.1 it probably makes the output look worse in some cases when using that. RL 2.1 is not really supported, so added a warning. * Fixed issue 130: use os.pathsep instead of ":" since ":" in windows is used in disk names (and we still pay for DOS idiocy, in 2009) * Fixed issue 128: headings level 3+ all looked the same * Ugly bugfix for Issue 126: crashes when using images in header + TOC * New tstyles section in the stylesheet provides more configurable list layouts and more powerful table styling. * Better syntax highlighting (supports bold/italic) * Workaround for issue 103 so you can use borderPadding as a list (but it will look wrong if you are using wordaxe <= 0.3.2) * Added fieldvalue style for field lists * Added optionlist tstyle, for option lists * Added collection of utility stylesheets and documented it * Improved command line parsing and stylesheet loading (guess extension like latest rst2latex does) * Fixed Issue 67: completely new list layouting code * Fixed Issue 116: crashes caused by huge images * Better support for %width in images, n2ow it's % of the container frame's width, not of the text area. * Fixed bug in SVG scaling * Better handling of missing images * Added missing styles abstract, contents, dedication to the default stylesheet * Tables style support spaceBefore and spaceAfter * New topic-title style for topic titles (obvious ;-) * Vertical alignment for inline images (:align: parameter) * Issue 118: Support for :scale: in images and handle resizing of inline images * Issue 119: Fix placement of headers and footers * New background property for page templates (nice for presentations, for example) * Default to px for image width specifications instead of pt * Support all required measurement units ("em" "ex" "px" "in" "cm" "mm" "pt" "pc" "%" "") * New automated scripts to check test cases for "visual differences" * Respect images DPI property a bit like rst2latex does. * Issue 110: New --inline-footnotes option * Tested with reportlab from SVN trunk * Support for Dinu Gherman's svglib. If both svglib and uniconvertor are available, svglib is preferred (for SVG, of course). Patch originally by rute. * Issue 109: Separate styles for each kind of admonition * For Issue 109: missing styles are not a fatal error * Issue 117: TOCs with more than 6 levels now supported (raised limit to 9, which is silly deep) -- ("\''/").__..-''"`-. . 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 chris at subtlety.com Sat Jun 20 18:47:40 2009 From: chris at subtlety.com (Chris Bergstresser) Date: Sat, 20 Jun 2009 17:47:40 -0500 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> Message-ID: <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> Hi all -- ? I just started using ReportLab (through the rst2pdf library) and so I'm not entirely sure this isn't a problem with rst2pdf, but it certainly looks like a ReportLab bug. ?When it tries to draw tables, I get a: ValueError: Unknown color u'black' ? The last line of the stack is: File "c:\Python26\Lib\site-packages\reportlab-2.3-py2.6-win32.egg\reportlab\pdfgen\textobject.py", line 98, in setStrokeColor ?raise ValueError('Unknown color %r' % aColor) ? ... and a brief check of the code reveals this check above it: ? ?elif type(aColor) is StringType: ? ? ? ? ? ?self.setStrokeColor(toColor(aColor)) ?obviously, this fails because aColor is Unicode. ?(For that matter, toColor only accepts binary strings as well). I cannot, for the life of me, fathom *why*. ?At any rate, the fix is trivial, depending on the desired behavior--since I don't understand the rationale for refusing to accept Unicode in the first place, I'm hesitant to suggest a specific fix. -- Chris From ralsina at netmanagers.com.ar Sat Jun 20 19:01:38 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sat, 20 Jun 2009 20:01:38 -0300 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> Message-ID: <200906202001.39444.ralsina@netmanagers.com.ar> On Saturday 20 June 2009 19:47:40 Chris Bergstresser wrote: > Hi all -- > > I just started using ReportLab (through the rst2pdf library) and so > I'm not entirely sure this isn't a problem with rst2pdf, but it > certainly looks like a ReportLab bug. When it tries to draw tables, I > get a: > > ValueError: Unknown color u'black' > > The last line of the stack is: > > File > "c:\Python26\Lib\site-packages\reportlab-2.3-py2.6-win32.egg\reportlab\pdfg >en\textobject.py", line 98, in setStrokeColor > raise ValueError('Unknown color %r' % aColor) > > ... and a brief check of the code reveals this check above it: > > elif type(aColor) is StringType: > self.setStrokeColor(toColor(aColor)) > > obviously, this fails because aColor is Unicode. (For that matter, > toColor only accepts binary strings as well). I cannot, for the life > of me, fathom *why*. At any rate, the fix is trivial, depending on > the desired behavior--since I don't understand the rationale for > refusing to accept Unicode in the first place, I'm hesitant to suggest > a specific fix. Since I intend to keep supporting RL 2.3, could you post a simple test case in rst2pdf's bug tracker? Maybe it *is* rst2pdf's fault, and if it isn't I need to create a workaround anyway :-) -- ("\''/").__..-''"`-. . 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 samukham.inf at gmail.com Sun Jun 21 02:25:14 2009 From: samukham.inf at gmail.com (Sudhakar Samukham) Date: Sun, 21 Jun 2009 02:25:14 -0400 Subject: [reportlab-users] Reminder: Please Respond to Sudhakar's Invitation Message-ID: <920d520fe5a674a8392df69481dc25d1@localhost.localdomain> Sudhakar Samukham wants you to join Yaari! Is Sudhakar your friend? Yes, Sudhakar is my friend! No, Sudhakar isn't my friend. Please respond or Sudhakar may think you said no :( Thanks, The Yaari Team ----------------------------------------------------------- Yaari Inc., 358 Angier Ave NE Atlanta, GA 30312 Privacy Policy | Unsubscribe | Terms of Service YaariHAL668EOV346XDE256GBT433 -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at subtlety.com Sun Jun 21 18:29:03 2009 From: chris at subtlety.com (Chris Bergstresser) Date: Sun, 21 Jun 2009 17:29:03 -0500 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <200906202001.39444.ralsina@netmanagers.com.ar> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> <200906202001.39444.ralsina@netmanagers.com.ar> Message-ID: <7b0045ed0906211529x70950d14h4791057b832edfd5@mail.gmail.com> On Sat, Jun 20, 2009 at 6:01 PM, Roberto Alsina wrote: > On Saturday 20 June 2009 19:47:40 Chris Bergstresser wrote: >> ? I just started using ReportLab (through the rst2pdf library) and so >> I'm not entirely sure this isn't a problem with rst2pdf, but it >> certainly looks like a ReportLab bug. ?When it tries to draw tables, I >> get a: >> >> ValueError: Unknown color u'black' >> >> ? The last line of the stack is: >> >> File >> "c:\Python26\Lib\site-packages\reportlab-2.3-py2.6-win32.egg\reportlab\pdfg >>en\textobject.py", line 98, in setStrokeColor >> ?raise ValueError('Unknown color %r' % aColor) >> >> ? ... and a brief check of the code reveals this check above it: >> >> ? ?elif type(aColor) is StringType: >> ? ? ? ? ? ?self.setStrokeColor(toColor(aColor)) >> >> ?obviously, this fails because aColor is Unicode. ?(For that matter, >> toColor only accepts binary strings as well). I cannot, for the life >> of me, fathom *why*. ?At any rate, the fix is trivial, depending on >> the desired behavior--since I don't understand the rationale for >> refusing to accept Unicode in the first place, I'm hesitant to suggest >> a specific fix. > > Since I intend to keep supporting RL 2.3, could you post a simple test case in > rst2pdf's bug tracker? Maybe it *is* rst2pdf's fault, and if it isn't I need > to create a workaround anyway :-) I wish it were that simple. I'm calling rst2pdf.createpdf.RstToPdf().createPdf(doctree = doctree, output = dest, compressed = False) directly, so I need to mock up a table call, generate the doctree from it, and pass it on to the rst2pdf function. Since I'm recovering from the flu and about 2 weeks behind on something due by Tuesday, it'll have to wait a couple weeks. -- Chris From ralsina at netmanagers.com.ar Sun Jun 21 19:19:20 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sun, 21 Jun 2009 20:19:20 -0300 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <7b0045ed0906211529x70950d14h4791057b832edfd5@mail.gmail.com> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> <200906202001.39444.ralsina@netmanagers.com.ar> <7b0045ed0906211529x70950d14h4791057b832edfd5@mail.gmail.com> Message-ID: <200906212019.21077.ralsina@netmanagers.com.ar> On Sunday 21 June 2009 19:29:03 Chris Bergstresser wrote: > > Since I intend to keep supporting RL 2.3, could you post a simple test > > case in rst2pdf's bug tracker? Maybe it is rst2pdf's fault, and if it > > isn't I need to create a workaround anyway :-) > > I wish it were that simple. I'm calling > rst2pdf.createpdf.RstToPdf().createPdf(doctree = doctree, output = > dest, compressed = False) directly, so I need to mock up a table call, > generate the doctree from it, and pass it on to the rst2pdf function. > Since I'm recovering from the flu and about 2 weeks behind on > something due by Tuesday, it'll have to wait a couple weeks. Fine by me. Using "synthetic" doctrees (not generated by the docutils parser) is not tested at all, 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) "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 gherman at darwin.in-berlin.de Mon Jun 22 03:35:16 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 22 Jun 2009 09:35:16 +0200 Subject: [reportlab-users] Wordles Message-ID: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> Hi, I had some fun y'day with wordle.net (see attached self-explaining sample PDF, generated with RL). See also: http://www.wordle.net/gallery/wrdl/959717/Svglib_on_wordles http://www.wordle.net/gallery/wrdl/959420/1000_identifiers_and_keywords_in_ReportLab_2.3%27s_Python_code_basis It's a pitty wordle.net doesn't provide a real API, or one could make this a nice SVG widget for ReportLab... Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: svglib_wordle.pdf Type: application/pdf Size: 24919 bytes Desc: not available Url : From robin at reportlab.com Mon Jun 22 04:55:22 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 22 Jun 2009 09:55:22 +0100 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <7b0045ed0906211529x70950d14h4791057b832edfd5@mail.gmail.com> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> <200906202001.39444.ralsina@netmanagers.com.ar> <7b0045ed0906211529x70950d14h4791057b832edfd5@mail.gmail.com> Message-ID: <4A3F46FA.6080302@chamonix.reportlab.co.uk> Chris Bergstresser wrote: > On Sat, Jun 20, 2009 at 6:01 PM, Roberto > Alsina wrote: >> On Saturday 20 June 2009 19:47:40 Chris Bergstresser wrote: >>> I just started using ReportLab (through the rst2pdf library) and so >>> I'm not entirely sure this isn't a problem with rst2pdf, but it >>> certainly looks like a ReportLab bug. When it tries to draw tables, I >>> get a: >>> >>> ValueError: Unknown color u'black' >>> ....... I think I have fixed the bug in the rl trunk at least. At least toColor(u'black') doesn't fail miserably now. -- Robin Becker From andy at reportlab.com Mon Jun 22 06:21:20 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 22 Jun 2009 11:21:20 +0100 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> References: <7b0045ed0906201546m734852f3k97708ed2bef23bee@mail.gmail.com> <7b0045ed0906201547s77229a87gaa338e6ac912407e@mail.gmail.com> Message-ID: <956003ae0906220321j553e18fal9e844b5c9b2cfd41@mail.gmail.com> 2009/6/20 Chris Bergstresser : > ?obviously, this fails because aColor is Unicode. ?(For that matter, > toColor only accepts binary strings as well). I cannot, for the life > of me, fathom *why*. Because Python didn't have Unicode strings when we wrote that code, and you're the first person to report the issue! It's fixed now. We try now to accept either unicode or 8-bit strings in most places. -- Andy From andy at reportlab.com Mon Jun 22 06:27:44 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 22 Jun 2009 11:27:44 +0100 Subject: [reportlab-users] Wordles In-Reply-To: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> References: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> Message-ID: <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> 2009/6/22 Dinu Gherman : > Hi, > I had some fun y'day with wordle.net (see attached self-explaining > sample PDF, generated with RL). Neat app. BTW, one thing I've seen done with these before is to remove all the standard Python keywords, so that the remaining ones tend to show "what the library is about..." But he throws down a huge challenge in his FAQ... "This would have been completely impossible without the Java platform" Users, are you men or mice? - Andy From ralsina at netmanagers.com.ar Mon Jun 22 06:27:31 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 22 Jun 2009 07:27:31 -0300 Subject: [reportlab-users] Wordles In-Reply-To: <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> References: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> Message-ID: <200906220727.31965.ralsina@netmanagers.com.ar> On Monday 22 June 2009 07:27:44 Andy Robinson wrote: > 2009/6/22 Dinu Gherman : > > Hi, > > I had some fun y'day with wordle.net (see attached self-explaining > > sample PDF, generated with RL). > > Neat app. BTW, one thing I've seen done with these before is to > remove all the standard Python keywords, so that the remaining ones > tend to show "what the library is about..." > > But he throws down a huge challenge in his FAQ... > "This would have been completely impossible without the Java platform" > > Users, are you men or mice? Well, it looks like just word frequencies and a packing algorithm, or am I missing something? I expect I could slap something together in one afternoon or two (without my current flu, that is). -- ("\''/").__..-''"`-. . 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 gherman at darwin.in-berlin.de Mon Jun 22 07:01:57 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 22 Jun 2009 13:01:57 +0200 Subject: [reportlab-users] Wordles In-Reply-To: <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> References: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> Message-ID: <6A045513-E677-4FA4-9FA0-45395945503F@darwin.in-berlin.de> Andy Robinson: > Neat app. BTW, one thing I've seen done with these before is to > remove all the standard Python keywords, so that the remaining ones > tend to show "what the library is about..." Even then it would be very "selfish". I made versions without "self", which looked more balanced, but one really needs to play a lot with this applet to find out the best params. And being an applet doesn't really help. Or said Twitter-like: #java #fail. Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From gherman at darwin.in-berlin.de Mon Jun 22 07:03:46 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 22 Jun 2009 13:03:46 +0200 Subject: [reportlab-users] Wordles In-Reply-To: <200906220727.31965.ralsina@netmanagers.com.ar> References: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> <200906220727.31965.ralsina@netmanagers.com.ar> Message-ID: Roberto Alsina: > Well, it looks like just word frequencies and a packing algorithm, > or am I > missing something? I expect I could slap something together in one > afternoon or two (without my current flu, that is). Basically the best part is the layouting. Still strange to make such a fuzz of it... Well, get better, and then, go ahead! ;-) Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From simone.dalmasso at gmail.com Mon Jun 22 11:47:54 2009 From: simone.dalmasso at gmail.com (Simone Dalmasso) Date: Mon, 22 Jun 2009 17:47:54 +0200 Subject: [reportlab-users] Multipage pdf Message-ID: Hi, I would like to build a script which creates a pdf with a content depending of user requests. The pdf is requested via http and it contains some tables. The user can request more than one table and the table could be longer tha an A4 page. For now I can print one table at time using the Table platypus. Can you tell me which is the best way to add more tha one table and in more than one page? Maybe I have to use a DocTemplate but is not clear how to use it with a table and on an http response. Thanks for the suggestions. Simone -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Mon Jun 22 12:10:22 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 22 Jun 2009 17:10:22 +0100 Subject: [reportlab-users] Multipage pdf In-Reply-To: References: Message-ID: <956003ae0906220910s106ebb80qdac8b2133eeb4bf3@mail.gmail.com> 2009/6/22 Simone Dalmasso : > Hi, I would like to build a script which creates a pdf with a content > depending of user requests. > The pdf is requested via http and it contains some tables. The user can > request more than one table and the table could be longer tha an A4 page. > For now I can print one table at time using the Table platypus. Can you tell > me which is the best way to add more tha one table and in more than one > page? Have you read the chapter of the User Guide on "Platypus"? It's all about multi-page documents. Also, I suggest studying the scripts in the tests/ folder, especially the ones with 'platypus' in the name; some of these generate documents with tables. > Maybe I have to use a DocTemplate but is not clear how to use it with a > table and on an http response. The HTTP part is nothing to do with ReportLab; it depends entirely which web framework you are using. However, it may be useful to know that you can save a document to a cStringIO buffer instead of a file on disk. There's a small example in the Django wiki which should get you started: http://docs.djangoproject.com/en/dev/howto/outputting-pdf/ - andy From richard at ootbcomputers.com Mon Jun 22 21:13:17 2009 From: richard at ootbcomputers.com (richard at ootbcomputers.com) Date: Mon, 22 Jun 2009 18:13:17 -0700 Subject: [reportlab-users] Fillable forms Message-ID: <20090623011326.850AF47041B@mailer.thecornbread.com> Wondering if I can create a form that my users can download and then fill in with acrobat reader. TIA -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Tue Jun 23 06:18:08 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 23 Jun 2009 11:18:08 +0100 Subject: [reportlab-users] testing Message-ID: <4A40ABE0.7070401@chamonix.reportlab.co.uk> testing -- Robin Becker From robin at reportlab.com Tue Jun 23 06:34:52 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 23 Jun 2009 11:34:52 +0100 Subject: [reportlab-users] Mailinglist problem In-Reply-To: <4A40A8EE.8030507@brainbot.com> References: <4A40A8EE.8030507@brainbot.com> Message-ID: <4A40AFCC.5080204@chamonix.reportlab.co.uk> .......... > > This is an automatically generated Delivery Status Notification > > Delivery to the following recipient failed permanently: > > reportlab-users at reportlab.com > > Technical details of permanent failure: Message rejected. Please visit > http://www.google.com/mail/help/bulk_mail.html to review our Bulk Email > Senders Guidelines. > > > This seems somewhat strange since I have successfully posted to the > mailinglist in the past. Could this be a configuration issue on your > side? I checked the link above but did't find anything useful. > Furthermore the only recipient of my mail was the reportlab mailinglist > - which should not really qualify as a bulk mail. > > I would be happy if somebody could check whats going wrong, maybe other > people have the same problem. ....... Hi Volker, luckily we don't actually host the list it's provided by an old supplier of ours at two.pairlist.net; I checked and you are subscribed both as volker.haas at brainbot.com and pediapress.com For what it's worth we are using google for mail support. So the mx for reportlab.com is directed to google mail and we have a group setup for the user reportlab-users at reportlab.com so far as I can tell that 'group' has only one user in our system ie reportlab-users at two.pairlist.net which is the real address of the list. You can certainly email there and see if that gets through. I'm not sure if the way we've set this up is the best way, but certainly others are using this list and it seems to work. If anyone else knows what Volker's error message really means can they say? I have seen this in the past with our lists when I have managed to mis-configure a dns or ip address somewhere. -- Robin Becker From volker.haas at brainbot.com Tue Jun 23 06:39:43 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 23 Jun 2009 12:39:43 +0200 Subject: [reportlab-users] Mailinglist problem In-Reply-To: <4A40AFCC.5080204@chamonix.reportlab.co.uk> References: <4A40A8EE.8030507@brainbot.com> <4A40AFCC.5080204@chamonix.reportlab.co.uk> Message-ID: <4A40B0EF.4040004@brainbot.com> Let's see if this mail gets through ;) Robin Becker wrote: > .......... >> >> This is an automatically generated Delivery Status Notification >> >> Delivery to the following recipient failed permanently: >> >> reportlab-users at reportlab.com >> >> Technical details of permanent failure: Message rejected. Please >> visit http://www.google.com/mail/help/bulk_mail.html to review our >> Bulk Email Senders Guidelines. >> >> >> This seems somewhat strange since I have successfully posted to the >> mailinglist in the past. Could this be a configuration issue on your >> side? I checked the link above but did't find anything useful. >> Furthermore the only recipient of my mail was the reportlab >> mailinglist - which should not really qualify as a bulk mail. >> >> I would be happy if somebody could check whats going wrong, maybe >> other people have the same problem. > ....... > Hi Volker, > > luckily we don't actually host the list it's provided by an old > supplier of ours at two.pairlist.net; I checked and you are subscribed > both as volker.haas at brainbot.com and pediapress.com > > For what it's worth we are using google for mail support. So the mx > for reportlab.com is directed to google mail and we have a group setup > for the user > > reportlab-users at reportlab.com > > so far as I can tell that 'group' has only one user in our system ie > > reportlab-users at two.pairlist.net > > which is the real address of the list. You can certainly email there > and see if that gets through. > > I'm not sure if the way we've set this up is the best way, but > certainly others are using this list and it seems to work. > > If anyone else knows what Volker's error message really means can they > say? I have seen this in the past with our lists when I have managed > to mis-configure a dns or ip address somewhere. -- 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 volker.haas at brainbot.com Tue Jun 23 06:42:17 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 23 Jun 2009 12:42:17 +0200 Subject: [reportlab-users] Paragraph height wrong when using xml font tags Message-ID: <4A40B189.7090909@brainbot.com> 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.e. * Paragraph('text', someStyle) has an *incorrect* height adding some "plain" text fixes this: * Paragraph('text X', someStyle) has the correct height Obviously it would make more sense in the first example to change the line height of the paragraph style but this is not feasible for my use case. The effect of the wrong height calculation is that consecutive paragraphs overlap. See the attached minimal example for details. I tested this with the current trunk version of reportlab. It would be great if this could be fixed. Thanks, Volker p.s. Sorry if this mail arrives twice...This seems to be the consequence of posting to reportlab-users at two.pairlist.net and not reportlab-users at reportlab.com -- 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: rl_test.py Type: text/x-python Size: 633 bytes Desc: not available Url : From ralsina at netmanagers.com.ar Tue Jun 23 06:46:05 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 23 Jun 2009 07:46:05 -0300 Subject: [reportlab-users] Mailinglist problem In-Reply-To: <4A40AFCC.5080204@chamonix.reportlab.co.uk> References: <4A40A8EE.8030507@brainbot.com> <4A40AFCC.5080204@chamonix.reportlab.co.uk> Message-ID: <200906230746.06226.ralsina@netmanagers.com.ar> On Tuesday 23 June 2009 07:34:52 Robin Becker wrote: > If anyone else knows what Volker's error message really means can they say? > I have seen this in the past with our lists when I have managed to > mis-configure a dns or ip address somewhere. > Technical details of permanent failure: Message rejected. Please visit > http://www.google.com/mail/help/bulk_mail.html to review our Bulk Email > Senders Guidelines. Probably means that Volker's SMTP server has a bad reputation with google because of one of the following: * It's used to send spam * Lacks reverse DNS * Is in some kind of RBL (although google doesn't use any public ones) The solution is for Volker to call his sysadmin/ISP/cousin-that-configured- his-server and complain that he can't send mail to google. -- ("\''/").__..-''"`-. . 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 djan at reportlab.com Tue Jun 23 06:51:51 2009 From: djan at reportlab.com (Djan Obuobi) Date: Tue, 23 Jun 2009 11:51:51 +0100 Subject: [reportlab-users] Mailinglist problem In-Reply-To: <4A40B0EF.4040004@brainbot.com> References: <4A40A8EE.8030507@brainbot.com> <4A40AFCC.5080204@chamonix.reportlab.co.uk> <4A40B0EF.4040004@brainbot.com> Message-ID: <1f4b079f0906230351m60ef8c8ew1d8bb71c12fdb95@mail.gmail.com> Volker, the one to two.pairlist.net certainly gets seen. On Tue, Jun 23, 2009 at 11:39 AM, Volker Haas wrote: > Let's see if this mail gets through ;) > > > > ....... > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Thanks Djan Obuobi Business Analyst ReportLab Europe Ltd. Media House 3 Palmerston Road London SW19 1PG United Kingdom Tel +44 20 8545 1570 Fax +44 20 8545 1571 -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Tue Jun 23 07:03:46 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 23 Jun 2009 12:03:46 +0100 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <4A40B189.7090909@brainbot.com> References: <4A40B189.7090909@brainbot.com> Message-ID: <4A40B692.6080209@chamonix.reportlab.co.uk> 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.e. > * Paragraph('text', someStyle) has an *incorrect* > height > adding some "plain" text fixes this: > * Paragraph('text X', someStyle) has the correct > height OK I'll have a look at this soon. I think this is the result of having a fast path for paragraphs with only a single style; probably there's some difference in the height calculation. -- Robin Becker From H.vonBargen at t-p.com Tue Jun 23 07:12:43 2009 From: H.vonBargen at t-p.com (Henning von Bargen) Date: Tue, 23 Jun 2009 13:12:43 +0200 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: Message-ID: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> > From: Volker Haas > Subject: Paragraph height wrong when using xml font tags > > 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.e. > * Paragraph('text', someStyle) > has an *incorrect* height > adding some "plain" text fixes this: > * Paragraph('text X', someStyle) > has the correct height > > Obviously it would make more sense in the first example to change > the line height of the paragraph style but this is not feasible > for my use case. > > The effect of the wrong height calculation is that consecutive > paragraphs overlap. > > See the attached minimal example for details. I tested this with the > current trunk version of reportlab. > > It would be great if this could be fixed. > > Thanks, > Volker -1 from me: Using different font sizes inside a paragraph is considered bad typographic style AFAIK. If you really have to use different font sizes, then you should adjust the leading accordingly to prevent overlapping. If RL did adjust the height calculation automatically it would result in an unsteady layout, because the base lines wouldn't be equidistant any more. Henning From volker.haas at brainbot.com Tue Jun 23 07:52:53 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Tue, 23 Jun 2009 13:52:53 +0200 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> Message-ID: <4A40C215.2060708@brainbot.com> Henning von Bargen wrote: > If RL did adjust the height calculation automatically > it would result in an unsteady layout, because the base lines > wouldn't be equidistant any more. > > Henning > Line heights are adjusted automatically only if this is explicitly permitted by setting "autoLeading" to "max" for example. --> style = ParagraphStyle('test') style.autoLeading = 'max' So this should not be a general problem. 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/ From ralsina at netmanagers.com.ar Tue Jun 23 07:59:59 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 23 Jun 2009 08:59:59 -0300 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> Message-ID: <200906230859.59548.ralsina@netmanagers.com.ar> On Tuesday 23 June 2009 08:12:43 Henning von Bargen wrote: > > From: Volker Haas > > Subject: Paragraph height wrong when using xml font tags > > > > 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.e. > > * Paragraph('text', someStyle) > > has an *incorrect* height > > adding some "plain" text fixes this: > > * Paragraph('text X', someStyle) > > has the correct height > > > > Obviously it would make more sense in the first example to change > > the line height of the paragraph style but this is not feasible > > for my use case. > > > > The effect of the wrong height calculation is that consecutive > > paragraphs overlap. > > > > See the attached minimal example for details. I tested this with the > > current trunk version of reportlab. > > > > It would be great if this could be fixed. > > > > Thanks, > > Volker > > -1 from me: > > Using different font sizes inside a paragraph is considered > bad typographic style AFAIK. > > If you really have to use different font sizes, then > you should adjust the leading accordingly to prevent overlapping. > > If RL did adjust the height calculation automatically > it would result in an unsteady layout, because the base lines > wouldn't be equidistant any more. But the problem here is with a paragraph with a single font size. -- ("\''/").__..-''"`-. . 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 gherman at darwin.in-berlin.de Tue Jun 23 08:30:53 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 23 Jun 2009 14:30:53 +0200 Subject: [reportlab-users] Wordles In-Reply-To: <200906220727.31965.ralsina@netmanagers.com.ar> References: <08689110-7550-489D-8A4A-922FA1C75D6B@darwin.in-berlin.de> <956003ae0906220327q7fcc6acdoe5cb88e3a5520811@mail.gmail.com> <200906220727.31965.ralsina@netmanagers.com.ar> Message-ID: Roberto Alsina: > Well, it looks like just word frequencies and a packing algorithm, > or am I > missing something? I expect I could slap something together in one > afternoon or two (without my current flu, that is). I hacked up a proof of concept thingy using GraphViz neato. Doesn't look really sexy, and for now I cannot see a way to further reduce empty space between words. Added to the list of projects for rainy days... Dinu -------------- next part -------------- ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- A non-text attachment was scrubbed... Name: nmap.pdf Type: application/pdf Size: 16317 bytes Desc: not available Url : From robin at reportlab.com Tue Jun 23 09:30:39 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 23 Jun 2009 14:30:39 +0100 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <200906230859.59548.ralsina@netmanagers.com.ar> References: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AAE@ROHRPOSTIX.tup.ads> <200906230859.59548.ralsina@netmanagers.com.ar> Message-ID: <4A40D8FF.6090608@chamonix.reportlab.co.uk> ....... > > But the problem here is with a paragraph with a single font size. > I said earlier that I thought this must relate to the use of a single tag encompassing the whole of the paragraph. That means there are no style changes internally so I think it gets handled by a so called 'fast path'. There must be some difference in the way things are handled for the fast versus the slow path. The implication is that 'this is red' will get a different treatment to 'this is red' because there are two fragments in the latter so it goes through the general (slow) path. In the fast path case we appear to have assumed that the single fragment styling will have come from the supplied style rather than as in this case to have been supplied in the text of the paragraph. In this particular corner case we need either to force things into the slow path or to change the way the height is calculated in wrap and other places where we rely on the style rather than the actual fragments. -- Robin Becker From bhiggins at gmail.com Tue Jun 23 18:24:29 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Tue, 23 Jun 2009 15:24:29 -0700 Subject: [reportlab-users] Box with title and content portions having different background colors Message-ID: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> Hi all, I've been trying to create a box that looks like this: +----------------+ | Title | |+--------------+| || || || Content || || || || || |+--------------+| +----------------+ I want the content area background to be white, and containing background gray. My first attempt was to use a 3x3 table. This worked almost perfectly, but when the content is bigger than a page I get a LayoutError Flowable "too large" exception. From reading the archives, I gather that table cells aren't able to be larger than a page. I'm now trying to find some other way to accomplish this design. Any tips? Thanks! Ben P.S. Everything else about ReportLab has been working great. Thanks for a fine product. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Tue Jun 23 18:45:23 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 23 Jun 2009 19:45:23 -0300 Subject: [reportlab-users] Box with title and content portions having different background colors In-Reply-To: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> References: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> Message-ID: <200906231945.24106.ralsina@netmanagers.com.ar> On Tuesday 23 June 2009 19:24:29 Benjamin Higgins wrote: > Hi all, > > I've been trying to create a box that looks like this: > > +----------------+ > > | Title | > |+--------------+| > | > || Content || > | > |+--------------+| > > +----------------+ > > I want the content area background to be white, and containing background > gray. > > My first attempt was to use a 3x3 table. This worked almost perfectly, but > when the content is bigger than a page I get a LayoutError Flowable "too > large" exception. From reading the archives, I gather that table cells > aren't able to be larger than a page. > > I'm now trying to find some other way to accomplish this design. > > Any tips? How about just drawing the grey background and white boxes in beforePage? -- ("\''/").__..-''"`-. . 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 bhiggins at gmail.com Tue Jun 23 19:41:54 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Tue, 23 Jun 2009 16:41:54 -0700 Subject: [reportlab-users] Box with title and content portions having different background colors In-Reply-To: <200906231945.24106.ralsina@netmanagers.com.ar> References: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> <200906231945.24106.ralsina@netmanagers.com.ar> Message-ID: <4f38543c0906231641h1d0c4355t2bc0a087a59d7c04@mail.gmail.com> Well, there's going to be any number of these boxes appearing - it could be just one or maybe a dozen, each with different contents and heights - so I was hoping to implement it as a flowable element. On Tue, Jun 23, 2009 at 3:45 PM, Roberto Alsina wrote: > On Tuesday 23 June 2009 19:24:29 Benjamin Higgins wrote: > > Hi all, > > > > I've been trying to create a box that looks like this: > > > > +----------------+ > > > > | Title | > > |+--------------+| > > | > > || Content || > > | > > |+--------------+| > > > > +----------------+ > > > > I want the content area background to be white, and containing background > > gray. > > > > My first attempt was to use a 3x3 table. This worked almost perfectly, > but > > when the content is bigger than a page I get a LayoutError Flowable "too > > large" exception. From reading the archives, I gather that table cells > > aren't able to be larger than a page. > > > > I'm now trying to find some other way to accomplish this design. > > > > Any tips? > > How about just drawing the grey background and white boxes in beforePage? > > -- > ("\''/").__..-''"`-. . 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thingfu at gmail.com Tue Jun 23 20:50:20 2009 From: thingfu at gmail.com (Lucas Howell) Date: Tue, 23 Jun 2009 18:50:20 -0600 Subject: [reportlab-users] SimpleDocTemplate Margin Problems Message-ID: Hi All, I'm having a problem when using the SimpleDocTemplate with Paragraphs that cause an unpredictable margin. Basically I specify a margin of 0.5 inches in the Template and it works just fine when Table Flowables are added to the Story, but when I add Paragraphs (with leftIndent=0 specified) the margin is like 0.6 inches or more. Thus my various flowables don't line up on page (paragraphs have some extra mysterious indentation). There's got to be some extra padding or something in the SimpleDocTemplate or Paragraphs that I don't know about, but everything is zeroed out, so it doesn't make sense. Some example code is below: --------------------------------- response = HttpResponse(mimetype='application/pdf') response['Content-Disposition'] = 'attachment; filename=example.pdf;' doc = SimpleDocTemplate(filename=response, pagesize=letter, topMargin=0.5*inch, bottomMargin=0.5*inch, leftMargin=0.5*inch, rightMargin=0.5*inch) my_paragraph_style = ParagraphStyle(name='my_paragraph_style',fontName='Helvetica', fontSize=11,leading=12,spaceBefore=0,leftIndent=0) p1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed egestas' Story = [] Story.append(Paragraph(p1,my_paragraph_style)) doc.build(Story, onFirstPage=myFirstPage,onLaterPages=myLaterPages) return response --------------------------------- This code results in a PDF with the paragraph having roughly a 0.6in margin instead of a 0.5inch margin. Any responses would be appreciated! I've looked through all the documentation and can't find any explanation for this "extra" margin / padding that shows up and causes my alignment to be off. Thanks, Lucas From dfh at forestfield.co.uk Wed Jun 24 05:26:37 2009 From: dfh at forestfield.co.uk (David Hughes) Date: Wed, 24 Jun 2009 10:26:37 +0100 Subject: [reportlab-users] SimpleDocTemplate Margin Problems In-Reply-To: References: Message-ID: <4A41F14D.6080802@forestfield.co.uk> Lucas Howell wrote: > Hi All, > > I'm having a problem when using the SimpleDocTemplate with Paragraphs > that cause an unpredictable margin. > > Basically I specify a margin of 0.5 inches in the Template and it > works just fine when Table Flowables are added to the Story, but when > I add Paragraphs (with leftIndent=0 specified) the margin is like 0.6 > inches or more. Thus my various flowables don't line up on page > (paragraphs have some extra mysterious indentation). There's got to > be some extra padding or something in the SimpleDocTemplate or > Paragraphs that I don't know about, but everything is zeroed out, so > it doesn't make sense. > As I understand it, DocTemplate puts the paragraph into a Frame (see platypus/frames.py) which has padding around it that defaults to 6 points - just under 0.1 inches. The call from doctemplate.py to instantiate Frame doesn't include any padding arguments, so the default setting is used. Regards, David Hughes Forestfield Software -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Jun 24 05:36:13 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 24 Jun 2009 10:36:13 +0100 Subject: [reportlab-users] SimpleDocTemplate Margin Problems In-Reply-To: References: Message-ID: <4A41F38D.2060104@chamonix.reportlab.co.uk> Lucas Howell wrote: > Hi All, > > I'm having a problem when using the SimpleDocTemplate with Paragraphs > that cause an unpredictable margin. > > Basically I specify a margin of 0.5 inches in the Template and it > works just fine when Table Flowables are added to the Story, but when > I add Paragraphs (with leftIndent=0 specified) the margin is like 0.6 > inches or more. Thus my various flowables don't line up on page > (paragraphs have some extra mysterious indentation). There's got to > be some extra padding or something in the SimpleDocTemplate or > Paragraphs that I don't know about, but everything is zeroed out, so > it doesn't make sense. > > Some example code is below: ....... There should be no difference between paragraphs and left aligned tables. What's wrong is that frames have a default padding of 6pts. To fix that set the frame padding to 0 in your first page routine. For simplicity the SimpleDoctemplate class dosn't really give you much control of the page templates. -- Robin Becker -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: tt.py Url: From michael.dorrian at gmail.com Wed Jun 24 15:47:04 2009 From: michael.dorrian at gmail.com (Michael Dorrian) Date: Thu, 25 Jun 2009 04:47:04 +0900 Subject: [reportlab-users] Box with title and content portions having different background colors In-Reply-To: <4f38543c0906231641h1d0c4355t2bc0a087a59d7c04@mail.gmail.com> References: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> <200906231945.24106.ralsina@netmanagers.com.ar> <4f38543c0906231641h1d0c4355t2bc0a087a59d7c04@mail.gmail.com> Message-ID: <9638c6950906241247p7db01438r11184a880ee75ef7@mail.gmail.com> Have u tried nesting a table and paragraph inside another table....here is an example....u could also nest two paragraphs inside a table or add more as needed....the reportlab examples are good for this...test_table_layout.py has alot of info on this... from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle from reportlab.lib.units import inch, cm from reportlab.platypus import Paragraph from reportlab.rl_config import defaultPageSize from reportlab.lib.units import inch,mm from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.pagesizes import A4,letter from reportlab.lib import colors def getTestTable(): t = Table((('Header 1','header 2','Header 3'), ('Quarter 1',100,200), ('Quarter 2',100,200), ('Quarter 3',100,200), ('Quarter 4',100,200), ('Total',400,600)), (60,80,46), (24, 16,16,16,18,18) ) return t def run(): doc = SimpleDocTemplate(filename="NestedTableTest.pdf", pagesize=A4, topMargin=0.5*inch, bottomMargin=0.5*inch, leftMargin=0.5*inch, rightMargin=0.5*inch,showboundary=1) my_paragraph_style =ParagraphStyle(name='my_paragraph_style',fontName='Helvetica',fontSize=11,leading=12,spaceBefore=0,leftIndent=0) p1 = 'Table Title' Story = [] ministy1 = TableStyle([('SPAN', (0, 0), (0, 0)),('GRID', (0,0), (-1,-1), 1.0, colors.black),]) ts = TableStyle([ ('GRID', (0,0), (-1,-1), 1.0, colors.black), ]) t = getTestTable() t.setStyle(ts) P = Paragraph(p1,my_paragraph_style) NestedTable = Table([[P],[t]],(200),style=ministy1) Story.append(NestedTable) doc.build(Story) if __name__ == "__main__": run() On Wed, Jun 24, 2009 at 8:41 AM, Benjamin Higgins wrote: > Well, there's going to be any number of these boxes appearing - it could be > just one or maybe a dozen, each with different contents and heights - so I > was hoping to implement it as a flowable element. > > > On Tue, Jun 23, 2009 at 3:45 PM, Roberto Alsina < > ralsina at netmanagers.com.ar> wrote: > >> On Tuesday 23 June 2009 19:24:29 Benjamin Higgins wrote: >> > Hi all, >> > >> > I've been trying to create a box that looks like this: >> > >> > +----------------+ >> > >> > | Title | >> > |+--------------+| >> > | >> > || Content || >> > | >> > |+--------------+| >> > >> > +----------------+ >> > >> > I want the content area background to be white, and containing >> background >> > gray. >> > >> > My first attempt was to use a 3x3 table. This worked almost perfectly, >> but >> > when the content is bigger than a page I get a LayoutError Flowable "too >> > large" exception. From reading the archives, I gather that table cells >> > aren't able to be larger than a page. >> > >> > I'm now trying to find some other way to accomplish this design. >> > >> > Any tips? >> >> How about just drawing the grey background and white boxes in beforePage? >> >> -- >> ("\''/").__..-''"`-. . 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 >> _______________________________________________ >> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From henning.vonbargen at arcor.de Wed Jun 24 16:24:25 2009 From: henning.vonbargen at arcor.de (Henning von Bargen) Date: Wed, 24 Jun 2009 22:24:25 +0200 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: References: Message-ID: <4A428B79.6060403@arcor.de> > From: Roberto Alsina > Subject: Re: [reportlab-users] Possible String/Unicode bug in > reportlab. Where do I report it? > To: Support list for users of Reportlab software > > Message-ID: <200906202001.39444.ralsina at netmanagers.com.ar> > Content-Type: Text/Plain; charset="utf-8" > > On Saturday 20 June 2009 19:47:40 Chris Bergstresser wrote: >> Hi all -- >> >> I just started using ReportLab (through the rst2pdf library) and so >> I'm not entirely sure this isn't a problem with rst2pdf, but it >> certainly looks like a ReportLab bug. When it tries to draw tables, I >> get a: >> >> ValueError: Unknown color u'black' >> >> The last line of the stack is: >> >> File >> "c:\Python26\Lib\site-packages\reportlab-2.3-py2.6-win32.egg\reportlab\pdfg >> en\textobject.py", line 98, in setStrokeColor >> raise ValueError('Unknown color %r' % aColor) >> >> ... and a brief check of the code reveals this check above it: >> >> elif type(aColor) is StringType: >> self.setStrokeColor(toColor(aColor)) >> >> obviously, this fails because aColor is Unicode. (For that matter, >> toColor only accepts binary strings as well). I cannot, for the life >> of me, fathom *why*. At any rate, the fix is trivial, depending on >> the desired behavior--since I don't understand the rationale for >> refusing to accept Unicode in the first place, I'm hesitant to suggest >> a specific fix. > > Since I intend to keep supporting RL 2.3, could you post a simple test case in > rst2pdf's bug tracker? Maybe it *is* rst2pdf's fault, and if it isn't I need > to create a workaround anyway :-) > There has been a change in the RL trunk colors.py recently, adding support for unicode colors, but that doesn't fix the error. The following additional little patch for reportlab/pdfgen/textobject.py makes rst2pdf-0.11 work with the RL trunk: Index: textobject.py =================================================================== --- textobject.py (revision 3505) +++ textobject.py (working copy) @@ -92,7 +92,7 @@ self.setStrokeColorCMYK(aColor[0], aColor[1], aColor[2], aColor[3]) else: raise ValueError('Unknown color %r' % aColor) - elif type(aColor) is StringType: + elif isinstance(aColor, basestring): self.setStrokeColor(toColor(aColor)) else: raise ValueError('Unknown color %r' % aColor) Henning From ralsina at netmanagers.com.ar Wed Jun 24 16:26:48 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 24 Jun 2009 17:26:48 -0300 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? In-Reply-To: <4A428B79.6060403@arcor.de> References: <4A428B79.6060403@arcor.de> Message-ID: <200906241726.48725.ralsina@netmanagers.com.ar> On Wednesday 24 June 2009 17:24:25 Henning von Bargen wrote: > There has been a change in the RL trunk colors.py recently, adding > support for unicode colors, but that doesn't fix the error. > > The following additional little patch for reportlab/pdfgen/textobject.py > makes rst2pdf-0.11 work with the RL trunk: Not being able to reproduce this is driving me nuts. What version of python are you using? -- ("\''/").__..-''"`-. . 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 bhiggins at gmail.com Wed Jun 24 20:24:46 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Wed, 24 Jun 2009 17:24:46 -0700 Subject: [reportlab-users] Box with title and content portions having different background colors In-Reply-To: <9638c6950906241247p7db01438r11184a880ee75ef7@mail.gmail.com> References: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> <200906231945.24106.ralsina@netmanagers.com.ar> <4f38543c0906231641h1d0c4355t2bc0a087a59d7c04@mail.gmail.com> <9638c6950906241247p7db01438r11184a880ee75ef7@mail.gmail.com> Message-ID: <4f38543c0906241724u70ce6d77re064f1a2bb641c9@mail.gmail.com> I did something similar but like I stated earlier, this won't work when a table cell doesn't fit on a page. On Wed, Jun 24, 2009 at 12:47 PM, Michael Dorrian wrote: > Have u tried nesting a table and paragraph inside another table....here is > an example....u could also nest two paragraphs inside a table or add more as > needed....the reportlab examples are good for this...test_table_layout.py > has alot of info on this... > > from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle > from reportlab.lib.units import inch, cm > from reportlab.platypus import Paragraph > from reportlab.rl_config import defaultPageSize > from reportlab.lib.units import inch,mm > from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle > from reportlab.lib.pagesizes import A4,letter > from reportlab.lib import colors > > def getTestTable(): > t = Table((('Header 1','header 2','Header 3'), > ('Quarter 1',100,200), > ('Quarter 2',100,200), > ('Quarter 3',100,200), > ('Quarter 4',100,200), > ('Total',400,600)), > (60,80,46), > (24, 16,16,16,18,18) > ) > return t > def run(): > doc = SimpleDocTemplate(filename="NestedTableTest.pdf", > pagesize=A4, > topMargin=0.5*inch, > bottomMargin=0.5*inch, > leftMargin=0.5*inch, > > rightMargin=0.5*inch,showboundary=1) > > my_paragraph_style > =ParagraphStyle(name='my_paragraph_style',fontName='Helvetica',fontSize=11,leading=12,spaceBefore=0,leftIndent=0) > p1 = 'Table Title' > Story = [] > ministy1 = TableStyle([('SPAN', (0, 0), (0, 0)),('GRID', (0,0), > (-1,-1), 1.0, colors.black),]) > ts = TableStyle([ > ('GRID', (0,0), (-1,-1), 1.0, colors.black), > ]) > t = getTestTable() > t.setStyle(ts) > P = Paragraph(p1,my_paragraph_style) > NestedTable = Table([[P],[t]],(200),style=ministy1) > Story.append(NestedTable) > doc.build(Story) > if __name__ == "__main__": > run() > > On Wed, Jun 24, 2009 at 8:41 AM, Benjamin Higgins wrote: > >> Well, there's going to be any number of these boxes appearing - it could >> be just one or maybe a dozen, each with different contents and heights - so >> I was hoping to implement it as a flowable element. >> >> >> On Tue, Jun 23, 2009 at 3:45 PM, Roberto Alsina < >> ralsina at netmanagers.com.ar> wrote: >> >>> On Tuesday 23 June 2009 19:24:29 Benjamin Higgins wrote: >>> > Hi all, >>> > >>> > I've been trying to create a box that looks like this: >>> > >>> > +----------------+ >>> > >>> > | Title | >>> > |+--------------+| >>> > | >>> > || Content || >>> > | >>> > |+--------------+| >>> > >>> > +----------------+ >>> > >>> > I want the content area background to be white, and containing >>> background >>> > gray. >>> > >>> > My first attempt was to use a 3x3 table. This worked almost perfectly, >>> but >>> > when the content is bigger than a page I get a LayoutError Flowable >>> "too >>> > large" exception. From reading the archives, I gather that table cells >>> > aren't able to be larger than a page. >>> > >>> > I'm now trying to find some other way to accomplish this design. >>> > >>> > Any tips? >>> >>> How about just drawing the grey background and white boxes in beforePage? >>> >>> -- >>> ("\''/").__..-''"`-. . 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 >>> _______________________________________________ >>> 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 >> >> > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Thu Jun 25 04:41:59 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 25 Jun 2009 09:41:59 +0100 Subject: [reportlab-users] Box with title and content portions having different background colors In-Reply-To: <4f38543c0906241724u70ce6d77re064f1a2bb641c9@mail.gmail.com> References: <4f38543c0906231524k3ae18f07t98472f340e1392d1@mail.gmail.com> <200906231945.24106.ralsina@netmanagers.com.ar> <4f38543c0906231641h1d0c4355t2bc0a087a59d7c04@mail.gmail.com> <9638c6950906241247p7db01438r11184a880ee75ef7@mail.gmail.com> <4f38543c0906241724u70ce6d77re064f1a2bb641c9@mail.gmail.com> Message-ID: <4A433857.5080702@chamonix.reportlab.co.uk> Benjamin Higgins wrote: > I did something similar but like I stated earlier, this won't work when a > table cell doesn't fit on a page. > ....... virtually nothing will work when a table cell won't fit in a complete frame since we assume that tables split and not the individual rows. -- Robin Becker From H.vonBargen at t-p.com Thu Jun 25 05:55:34 2009 From: H.vonBargen at t-p.com (Henning von Bargen) Date: Thu, 25 Jun 2009 11:55:34 +0200 Subject: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I post it? In-Reply-To: Message-ID: <910F0FAF6E2ABF428178EC4C7F8B6EDF049AB6@ROHRPOSTIX.tup.ads> > From: Roberto Alsina > Subject: Re: [reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it? > > > The following additional little patch for reportlab/pdfgen/textobject.py > > makes rst2pdf-0.11 work with the RL trunk: > Not being able to reproduce this is driving me nuts. What version of python > are you using? Python 2.6.2 on Windows. Installed ReportLab 2.3 Downloaded rst2pdf-0.11 and added it to the Python path. Renamed reportlab to ---reportlab in lib/site-packages SVN Checked out ReportLab trunk and added it to the Python path. Henning From bhiggins at gmail.com Thu Jun 25 16:08:28 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Thu, 25 Jun 2009 13:08:28 -0700 Subject: [reportlab-users] Jagged fonts when there are images on same page Message-ID: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> I'm thinking this is a problem with Acrobat, but I wanted to check to see if anyone has encountered anything similar. When I have an image (at 100 DPI) on a page, the fonts on that page end up looking more jaggy, maybe like they're not anti-aliased. I'm just using Helvetica and Helvetica-Bold. This seems to only happen in Acrobat, not in a couple other PDF viewers that I've tried. Any ideas as to how to fix this? Thanks, Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Fri Jun 26 04:09:12 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 26 Jun 2009 09:09:12 +0100 Subject: [reportlab-users] Jagged fonts when there are images on same page In-Reply-To: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> References: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> Message-ID: <956003ae0906260109o23f41865k86ac56b7bba2260b@mail.gmail.com> 2009/6/25 Benjamin Higgins : > Any ideas as to how to fix this? Try changing the image format. Is it a .png? We recently found Acrobat Reader on Linux caused colours drawn by us on a page to display very weirdly - greens and blues went fluorescent - on pages which had a certain kind of PNG with an alpha channel; I don't have the details. Switching the images from PNG to GIF fixed it. Acrobat Reader on Windows and Mac was fine. No idea if this is the same issue but it's worth a try. - Andy From robin at reportlab.com Fri Jun 26 06:22:27 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 26 Jun 2009 11:22:27 +0100 Subject: [reportlab-users] Paragraph height wrong when using xml font tags In-Reply-To: <4A40B189.7090909@brainbot.com> References: <4A40B189.7090909@brainbot.com> Message-ID: <4A44A163.6080807@chamonix.reportlab.co.uk> 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. However we still have this approximation in many places in the canvas drawing code. For many fonts the assumption is patently false ie the standard Courier font ascent+descent <= fontSize. I guess our model which is derived from computer land rather than print world is just wrong. In our model there's just leading and fontSize with default leading defined as fontSize*1.2; in this model the lines are leading apart ie leading = line spacing. In the print world we have ascent + descent and leading so the interline total is ascent+descent+leading. Leading is usually small and constant whereas ascent and descent are proportional to the font size. I made a big mistake when doing the work on auto line spacing (ie the autoLeading option) in not just reusing the original approximation ie instead of accumulating the more accurate ascent and descent values I should have just recorded the max fontSizes. There might have been some downsides to that, but less confusion. ....... -- Robin Becker From bhiggins at gmail.com Fri Jun 26 12:26:44 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Fri, 26 Jun 2009 09:26:44 -0700 Subject: [reportlab-users] Jagged fonts when there are images on same page In-Reply-To: <956003ae0906260109o23f41865k86ac56b7bba2260b@mail.gmail.com> References: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> <956003ae0906260109o23f41865k86ac56b7bba2260b@mail.gmail.com> Message-ID: <4f38543c0906260926he4977b5o1988701db33caefb@mail.gmail.com> Andy, Thanks for the tip, they are PNGs! And yes, the colors are off as well! I'm using Acrobat on Linux, but I've verified that the font problem happens on Windows and Mac as well, but I didn't check the color problem. Thanks! Ben On Fri, Jun 26, 2009 at 1:09 AM, Andy Robinson wrote: > 2009/6/25 Benjamin Higgins : > > Any ideas as to how to fix this? > > Try changing the image format. Is it a .png? > > We recently found Acrobat Reader on Linux caused colours drawn by us > on a page to display very weirdly - greens and blues went fluorescent > - on pages which had a certain kind of PNG with an alpha channel; I > don't have the details. Switching the images from PNG to GIF fixed > it. Acrobat Reader on Windows and Mac was fine. No idea if this > is the same issue but it's worth a try. > > - Andy > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Fri Jun 26 12:53:15 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 26 Jun 2009 17:53:15 +0100 Subject: [reportlab-users] Jagged fonts when there are images on same page In-Reply-To: <4f38543c0906260926he4977b5o1988701db33caefb@mail.gmail.com> References: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> <956003ae0906260109o23f41865k86ac56b7bba2260b@mail.gmail.com> <4f38543c0906260926he4977b5o1988701db33caefb@mail.gmail.com> Message-ID: <4A44FCFB.2000501@chamonix.reportlab.co.uk> Benjamin Higgins wrote: > Andy, > > Thanks for the tip, they are PNGs! And yes, the colors are off as well! > > I'm using Acrobat on Linux, but I've verified that the font problem happens > on Windows and Mac as well, but I didn't check the color problem. > > Thanks! > > Ben > if possible can you send us a sample of the png's that cause the problem. I suspect it's a problem with our masking technology for pngs. Also which fonts are going bad. We observed the colour problem in Acrobat Reader on linux, but our PNG's ddn't cause font problems and things appeared OK in Windows and Mac. -- Robin Becker From bhiggins at gmail.com Fri Jun 26 16:00:50 2009 From: bhiggins at gmail.com (Benjamin Higgins) Date: Fri, 26 Jun 2009 13:00:50 -0700 Subject: [reportlab-users] Jagged fonts when there are images on same page In-Reply-To: <4A44FCFB.2000501@chamonix.reportlab.co.uk> References: <4f38543c0906251308h4cef6ad4qa28e06f960cfd58a@mail.gmail.com> <956003ae0906260109o23f41865k86ac56b7bba2260b@mail.gmail.com> <4f38543c0906260926he4977b5o1988701db33caefb@mail.gmail.com> <4A44FCFB.2000501@chamonix.reportlab.co.uk> Message-ID: <4f38543c0906261300kfe08a21ucd08df4403464f6b@mail.gmail.com> The fonts were Helvetica and Helvetica-Bold. When I changed the PNGs to not have an alpha channel, the problem with colors & the fonts went away. Ben On Fri, Jun 26, 2009 at 9:53 AM, Robin Becker wrote: > Benjamin Higgins wrote: > >> Andy, >> >> Thanks for the tip, they are PNGs! And yes, the colors are off as well! >> >> I'm using Acrobat on Linux, but I've verified that the font problem >> happens >> on Windows and Mac as well, but I didn't check the color problem. >> >> Thanks! >> >> Ben >> >> > if possible can you send us a sample of the png's that cause the problem. I > suspect it's a problem with our masking technology for pngs. Also which > fonts are going bad. > > We observed the colour problem in Acrobat Reader on linux, but our PNG's > ddn't cause font problems and things appeared OK in Windows and Mac. > -- > Robin Becker > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From henning.vonbargen at arcor.de Fri Jun 26 17:51:19 2009 From: henning.vonbargen at arcor.de (Henning von Bargen) Date: Fri, 26 Jun 2009 23:51:19 +0200 Subject: [reportlab-users] ANN: wordaxe 0.3.3 released In-Reply-To: References: Message-ID: <4A4542D7.9090307@arcor.de> wordaxe 0.3.3 released. The wordaxe hyphenation library for Python, available at http://sourceforge.net/projects/deco-cow, now works without warnings under Python 2.6. It provides a paragraph implementation compatible to ReportLab and works well with rst2pdf. This is a bugfix release that doesn't contain any new features. It fixes a few bugs which were detected when the library was called from Roberto's rst2pdf. Henning From richard at ootbcomputers.com Sat Jun 27 17:04:40 2009 From: richard at ootbcomputers.com (Richard S) Date: Sat, 27 Jun 2009 14:04:40 -0700 (PDT) Subject: [reportlab-users] Fillable forms Message-ID: <8959227.170951246136680107.JavaMail.root@mailer> I guess my question might not make sense. I want to be able to create a pdf in reportlab and make certain parts of it blank so that a user could download the form open in acrobat reader and fill the form in. Is this possible in reportlab? -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Mon Jun 29 04:23:31 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 29 Jun 2009 09:23:31 +0100 Subject: [reportlab-users] Fillable forms In-Reply-To: <8959227.170951246136680107.JavaMail.root@mailer> References: <8959227.170951246136680107.JavaMail.root@mailer> Message-ID: <956003ae0906290123i8ab4204i19978af5a44a4479@mail.gmail.com> 2009/6/27 Richard S : > I guess my question might not make sense. > > I want to be able to create a pdf in reportlab and make certain parts of it > blank so that a user could download the form open in acrobat reader and fill > the form in. > > Is this possible in reportlab? No, sorry. -- Andy From jonas at reportlab.com Mon Jun 29 07:00:26 2009 From: jonas at reportlab.com (jonas wustrack) Date: Mon, 29 Jun 2009 12:00:26 +0100 Subject: [reportlab-users] brochure feedback & feed url In-Reply-To: <956003ae0906220703s6a721164v771fc36dd9aa1fc6@mail.gmail.com> References: <4A3668FF.5C05.00DF.0@hilton.com> <400ABD54D396694E97B8F966AFFBB66149BBFB913F@hwmxmsg10.hotels.ad.hilton.com> <956003ae0906190405i2aba92b1k66783b458f9064f5@mail.gmail.com> <956003ae0906190411y7b645aecv30fadbf2cd48fc8b@mail.gmail.com> <400ABD54D396694E97B8F966AFFBB66149BBFB916F@hwmxmsg10.hotels.ad.hilton.com> <956003ae0906220703s6a721164v771fc36dd9aa1fc6@mail.gmail.com> Message-ID: Dear David, Here is a list of the errors we found in the feed while scraping last weekend. The following hotels and sites have error tags in the xml (same list as last week): BREHI de BRUPM uk BRUPM de BSLHI uk BSLHI de BSLHI jp EILQS uk FRAHI uk FRAHI jp ISTHI uk LHRAP de LHRAP jp LHRHI de LHRHI jp MLEIR de MLEIR jp QKBVA uk QKBVA de QKBVA jp VIEHI uk VIEHI jp They all show one of the following 3 kinds of error messages: * "Could not get the value of property 'meetingRoom_desc' from the given node." * "The hotel referenced by that identifier (ctyhocn) is null." * "Could not get the value of property 'location_desc' from the given node." There are a few other errors in the feed (mostly missing tags): "desc" tag in "room_category" missing: ADLHI jp, ZRHHI de "desc" tag in "facility_category" missing: EDIDH uk Meeting room level has no name: AUHBT uk "short_desc" tag in "facility_category" missing: ALBSA uk, PMOHE de, SEZHI uk "name" tag in "room_category" is expected to contain a resource key (like EXEC) but contains the name "Club Rooms": GUMHI jp "highlight_desc" tag in "featured_hightlight" missing: KUCBL jp Please let me know if any of these points are unclear. Best Regards, -- Jonas From jonas at reportlab.com Mon Jun 29 07:30:56 2009 From: jonas at reportlab.com (jonas wustrack) Date: Mon, 29 Jun 2009 12:30:56 +0100 Subject: [reportlab-users] brochure feedback & feed url In-Reply-To: <400ABD54D396694E97B8F966AFFBB66149BC1287B2@hwmxmsg10.hotels.ad.hilton.com> References: <4A3668FF.5C05.00DF.0@hilton.com> <956003ae0906190405i2aba92b1k66783b458f9064f5@mail.gmail.com> <956003ae0906190411y7b645aecv30fadbf2cd48fc8b@mail.gmail.com> <400ABD54D396694E97B8F966AFFBB66149BBFB916F@hwmxmsg10.hotels.ad.hilton.com> <956003ae0906220703s6a721164v771fc36dd9aa1fc6@mail.gmail.com> <400ABD54D396694E97B8F966AFFBB66149BC1287B2@hwmxmsg10.hotels.ad.hilton.com> Message-ID: On Mon, Jun 29, 2009 at 12:03 PM, David Henderson1 wrote: > Jonas, > > In the list of CTYHOCNs you provided, is it possible that you can state which error > applies to which hotel as this will narrow the effort to resolve each of these issues. Below are the ctyhocns and sites affected by the different errors: "Could not get the value of property 'location_desc' from the given node." VIEHI uk VIEHI jp "The hotel referenced by that identifier (ctyhocn) is null." MLEIR de MLEIR jp QKBVA uk QKBVA de QKBVA jp "Could not get the value of property 'meetingRoom_desc' from the given node." BREHI de BRUPM uk BRUPM de BSLHI uk BSLHI de BSLHI jp EILQS uk FRAHI uk FRAHI jp ISTHI uk LHRAP de LHRAP jp LHRHI de LHRHI jp I hope this helps, Jonas From pythoniks at gmail.com Mon Jun 29 11:10:24 2009 From: pythoniks at gmail.com (Pascal Chambon) Date: Mon, 29 Jun 2009 17:10:24 +0200 Subject: [reportlab-users] Unhandled exception through pyreverse/graph In-Reply-To: References: <4A3668FF.5C05.00DF.0@hilton.com> <956003ae0906190405i2aba92b1k66783b458f9064f5@mail.gmail.com> <956003ae0906190411y7b645aecv30fadbf2cd48fc8b@mail.gmail.com> <400ABD54D396694E97B8F966AFFBB66149BBFB916F@hwmxmsg10.hotels.ad.hilton.com> <956003ae0906220703s6a721164v771fc36dd9aa1fc6@mail.gmail.com> <400ABD54D396694E97B8F966AFFBB66149BC1287B2@hwmxmsg10.hotels.ad.hilton.com> Message-ID: <4A48D960.9070400@gmail.com> Hello A minor problem with the graph generator : on windows vista (on my enterprise station), it crashes because it doens't manage to remove a temporary file it uses ; I have no idea why this happens (windows and its implicit file locks are often a mystery to me), but well it's only a temp file, so I've wrapped the unlink call between "try...except : pass" and it's OK that way. CF traceback below. Cheers for all the cool modules regards, Pascal Chambon self.run(args) File "C:\Python26\lib\site-packages\pylint-0.18.0-py2.6.egg\pylint\pyreverse\main.py", line 113, in run writer.DotWriter(self.config).write(diadefs) File "C:\Python26\lib\site-packages\pylint-0.18.0-py2.6.egg\pylint\pyreverse\writer.py", line 46, in write self.close_graph() File "C:\Python26\lib\site-packages\pylint-0.18.0-py2.6.egg\pylint\pyreverse\writer.py", line 134, in close _graph self.printer.generate(self.file_name) File "C:\Python26\lib\site-packages\logilab_common-0.41.0-py2.6.egg\logilab\common\graph.py", line 98, in g enerate os.unlink(dot_sourcepath) WindowsError: [Error 32] Le processus ne peut pas acc?der au fichier car ce fichier est utilis? par un autre processus: 'c:\\docume~1\\nrpw1851\\locals~1\\temp\\classes_No_Nameov_ppl.dot' jonas wustrack wrote: > On Mon, Jun 29, 2009 at 12:03 PM, David > Henderson1 wrote: > >> Jonas, >> >> In the list of CTYHOCNs you provided, is it possible that you can state which error >> applies to which hotel as this will narrow the effort to resolve each of these issues. >> > > Below are the ctyhocns and sites affected by the different errors: > > "Could not get the value of property 'location_desc' from the given node." > > VIEHI uk > VIEHI jp > > "The hotel referenced by that identifier (ctyhocn) is null." > > MLEIR de > MLEIR jp > QKBVA uk > QKBVA de > QKBVA jp > > "Could not get the value of property 'meetingRoom_desc' from the given node." > > BREHI de > BRUPM uk > BRUPM de > BSLHI uk > BSLHI de > BSLHI jp > EILQS uk > FRAHI uk > FRAHI jp > ISTHI uk > LHRAP de > LHRAP jp > LHRHI de > LHRHI jp > > I hope this helps, > Jonas > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajasekhar1242 at gmail.com Tue Jun 30 05:20:29 2009 From: rajasekhar1242 at gmail.com (Rajasekhar p) Date: Tue, 30 Jun 2009 14:50:29 +0530 Subject: [reportlab-users] Problem with PDF generation Message-ID: <99b4fbd60906300220l7d9437c8r73ee3edd4f021429@mail.gmail.com> Hi, I have developed a program to generate reports. I used reportlab 2.3 module now i can generate reports by using my program. But, i am not able to open PDF file automatically. I mean manually it will be opened when i click on that PDF file. I am sending my program as attach file with this mail. please give me any suggestions on this one. With Regards, Rajasekhar P -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dbpdfdept.py Type: application/octet-stream Size: 5006 bytes Desc: not available Url : From jonas at reportlab.com Tue Jun 30 06:00:48 2009 From: jonas at reportlab.com (jonas wustrack) Date: Tue, 30 Jun 2009 11:00:48 +0100 Subject: [reportlab-users] Problem with PDF generation In-Reply-To: <99b4fbd60906300220l7d9437c8r73ee3edd4f021429@mail.gmail.com> References: <99b4fbd60906300220l7d9437c8r73ee3edd4f021429@mail.gmail.com> Message-ID: If you simply want to open the pdf programatically the "open pdf" thread earlier this month on this list will answer your question: http://two.pairlist.net/pipermail/reportlab-users/2009-June/008455.html On Tue, Jun 30, 2009 at 10:20 AM, Rajasekhar p wrote: > Hi, > ?? ? I have developed a program to generate reports. I used reportlab 2.3 > module now i can generate reports by using my program. But, i am not able to > open PDF file automatically. I mean manually it will be opened when i click > on that PDF file. I am sending my program ?as attach file with this mail. > please give me any?suggestions?on this one. > With Regards, > Rajasekhar P > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > -- Jonas Wustrack Software Developer ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From andy at reportlab.com Tue Jun 30 07:35:14 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 30 Jun 2009 12:35:14 +0100 Subject: [reportlab-users] ReportLab is hiring! Message-ID: <956003ae0906300435j8fdeb1es88756bbab91f7e0c@mail.gmail.com> We're looking for up to two developers to join us in our London office, for immediate start. http://www.reportlab.com/about/careers/ People on this list hopefully have an idea what area we work in! 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 timr at probo.com Tue Jun 30 12:18:18 2009 From: timr at probo.com (Tim Roberts) Date: Tue, 30 Jun 2009 09:18:18 -0700 Subject: [reportlab-users] ReportLab is hiring! In-Reply-To: <956003ae0906300435j8fdeb1es88756bbab91f7e0c@mail.gmail.com> References: <956003ae0906300435j8fdeb1es88756bbab91f7e0c@mail.gmail.com> Message-ID: <4A4A3ACA.3020002@probo.com> Andy Robinson wrote: > We're looking for up to two developers to join us in our London > office, for immediate start. > Ah, if only you could promise to improve the weather. I live in northwestern Oregon, one of the rainiest places in America, and yet we are practically a tropical paradise compared to much of the UK... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From andy at reportlab.com Tue Jun 30 15:15:04 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 30 Jun 2009 20:15:04 +0100 Subject: [reportlab-users] ReportLab is hiring! In-Reply-To: <4A4A3ACA.3020002@probo.com> References: <956003ae0906300435j8fdeb1es88756bbab91f7e0c@mail.gmail.com> <4A4A3ACA.3020002@probo.com> Message-ID: <956003ae0906301215q3fe1eb0cld9abb55fa7e995c5@mail.gmail.com> 2009/6/30 Tim Roberts : > Ah, if only you could promise to improve the weather. ?I live in > northwestern Oregon, one of the rainiest places in America, and yet we > are practically a tropical paradise compared to much of the UK... Actually we are enjoying a great summer (and expecting more as the globe warms up...). The Wimbledon tennis folks built a retractable roof at great expense for this year's tournament, which has ensured us a rain-free fortnight... -- Andy From PEASLPW at mmc.org Tue Jun 30 15:50:13 2009 From: PEASLPW at mmc.org (Paul Peaslee) Date: Tue, 30 Jun 2009 15:50:13 -0400 Subject: [reportlab-users] ReportLab is hiring! In-Reply-To: <956003ae0906301215q3fe1eb0cld9abb55fa7e995c5@mail.gmail.com> References: <956003ae0906300435j8fdeb1es88756bbab91f7e0c@mail.gmail.com> <4A4A3ACA.3020002@probo.com> <956003ae0906301215q3fe1eb0cld9abb55fa7e995c5@mail.gmail.com> Message-ID: <4A4A3435.65E7.00AC.0@mmc.org> Paul 'Bo' Peaslee Database Administrator Maine Medical Center peaslpw at mmc.org 207.662.6523 >>> Andy Robinson 06/30/2009 15:15 >>> Actually we are enjoying a great summer (and expecting more as the globe warms up...). The Wimbledon tennis folks built a retractable roof at great expense for this year's tournament, which has ensured us a rain-free fortnight... -- Andy _______________________________________________ >>> Andy Robinson andy at reportlab.com> 06/30/2009 15:15 >> ( mailto:andy at reportlab.com> ) A vote for global warming? LOL. CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the use of the intended recipient(s) only and may contain information that is privileged, confidential, and prohibited from unauthorized disclosure under applicable law. If you are not the intended recipient of this message, any dissemination, distribution, or copying of this message is strictly prohibited. If you received this message in error, please notify the sender by reply email and destroy all copies of the original message and attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: