From yroman-reportlab at altalang.com Mon May 4 14:49:55 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Mon, 4 May 2009 14:49:55 -0400 Subject: [reportlab-users] Reducing use of 7-bit characters Message-ID: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> I've seen a few threads on here that talk about Outlook's tendency to encode RL PDFs as quoted-printable because of the low ratio of non-7-bit characters. We're running into occasional issues with this that, as far as I can tell, are from mail server mangling (same recipient/sender/PDF, different results). I know zipping it up is a solution, but that's an annoyance for users. I ran a test and sure enough Acrobat uses far less 7-bit characters for the same PDF at the same spec. Attached is my example. The Acrobat PDF was created by saving out the RL PDF from Acrobat, keeping the 1.3 spec. The RL PDF has 99.9% 7-bit characters, Acrobat 82.7%. That seems to be enough for Outlook to switch to base64. This thread talks about optional tweaks to reduce RL's 7-bit use: http://tinyurl.com/cwea65 But I don't see anything in rl_config.py to toggle these. Any ideas? Thanks, -- Yoann Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: test-image-RL.pdf Type: application/pdf Size: 5199 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: test-image-A9.pdf Type: application/pdf Size: 8586 bytes Desc: not available Url : From timr at probo.com Mon May 4 15:20:34 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 04 May 2009 12:20:34 -0700 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> Message-ID: <49FF4002.5010407@probo.com> Yoann Roman wrote: > I've seen a few threads on here that talk about Outlook's tendency to > encode RL PDFs as quoted-printable because of the low ratio of non-7-bit > characters. We're running into occasional issues with this that, as far > as I can tell, are from mail server mangling (same recipient/sender/PDF, > different results). > If you will permit me to be blunt, so what? The quoted-printable version works just fine, and it takes 25% less bandwidth than base64. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From yroman-reportlab at altalang.com Mon May 4 17:10:02 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Mon, 4 May 2009 17:10:02 -0400 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <49FF4002.5010407@probo.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> <49FF4002.5010407@probo.com> Message-ID: <016401c9ccfc$b07d5b00$0502000a@ad.altalang.com> >> I've seen a few threads on here that talk about Outlook's tendency to >> encode RL PDFs as quoted-printable because of the low ratio of non- >> 7-bit characters. We're running into occasional issues with this that, >> as far as I can tell, are from mail server mangling (same recipient/ >> sender/PDF, different results). > > If you will permit me to be blunt, so what? The quoted-printable > version works just fine, and it takes 25% less bandwidth than base64. The point is that, from experience, the quoted-printable version does not work just fine. Outlook does not encode the carriage returns / line feeds like it's supposed to for a binary file, and it seems something mangles them during transmission or the receiving end uses a different line break sequence. Given the size of these PDFs, the 25% increase is insignificant. -- Yoann Roman From andy at reportlab.com Tue May 5 02:41:48 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 5 May 2009 07:41:48 +0100 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> Message-ID: <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> 2009/5/4 Yoann Roman : > This thread talks about optional tweaks to reduce RL's 7-bit use: > http://tinyurl.com/cwea65 Switching between Ascii base 85 and Ascii base 64 probably wouldn't matter much as both are ASCII. There are other encoding options but also we might need to have less nice neat sub-80-character line endings; we could fiddle forever. If we could determine exactly what causes the problem in a manner ReportLab could reproduce in the lab, we could fiddle with things to fix it. Do you know if it's just the attaching process (i.e. attach then detach without even sending), if it needs an exchange server, which Outlook versions demonstrate this etc? - Andy From yroman-reportlab at altalang.com Tue May 5 08:35:17 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Tue, 5 May 2009 08:35:17 -0400 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> Message-ID: <002501c9cd7d$f232ee80$0502000a@ad.altalang.com> >> This thread talks about optional tweaks to reduce RL's 7-bit use: >> http://tinyurl.com/cwea65 >> > Switching between Ascii base 85 and Ascii base 64 probably wouldn't > matter much as both are ASCII. There are other encoding options but > also we might need to have less nice neat sub-80-character line > endings; we could fiddle forever. The base 85 streams aren't line wrapped in the output I'm getting. I actually tried playing with the line wrapping, and it didn't seem to do anything. > If we could determine exactly what causes the problem in a manner > ReportLab could reproduce in the lab, we could fiddle with things to > fix it. Do you know if it's just the attaching process (i.e. attach > then detach without even sending), if it needs an exchange server, > which Outlook versions demonstrate this etc? It depends on what you want to reproduce. I can reliably get Outlook 2003 to attach PDFs as quoted-printable, but I can't get the corruption to happen. The message definitely needs to be sent to get corrupted, and it only seems to be corrupt on the receiving end if (1) a mail server mangled the line endings or (2) the receiving end decodes with a different line ending than the original file had. The receiving end doesn't need to be an Exchange server (we don't use one and have a lot of problems with AOL recipients) nor does the recipient have to use Outlook (again, AOL users). I guess I'm just wondering how Acrobat encodes its streams differently to have a higher non-7-bit ratio and if there's an easy way to do the same thing in RL. Thanks, -- Yoann Roman From robin at reportlab.com Tue May 5 09:05:48 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 05 May 2009 14:05:48 +0100 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <002501c9cd7d$f232ee80$0502000a@ad.altalang.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> <002501c9cd7d$f232ee80$0502000a@ad.altalang.com> Message-ID: <4A0039AC.6070903@chamonix.reportlab.co.uk> Yoann Roman wrote: >>> This thread talks about optional tweaks to reduce RL's 7-bit use: >>> http://tinyurl.com/cwea65 >>> >> Switching between Ascii base 85 and Ascii base 64 probably wouldn't >> matter much as both are ASCII. There are other encoding options but >> also we might need to have less nice neat sub-80-character line >> endings; we could fiddle forever. > > The base 85 streams aren't line wrapped in the output I'm getting. I actually > tried playing with the line wrapping, and it didn't seem to do anything. > >> If we could determine exactly what causes the problem in a manner >> ReportLab could reproduce in the lab, we could fiddle with things to >> fix it. Do you know if it's just the attaching process (i.e. attach >> then detach without even sending), if it needs an exchange server, >> which Outlook versions demonstrate this etc? > > It depends on what you want to reproduce. I can reliably get Outlook 2003 to > attach PDFs as quoted-printable, but I can't get the corruption to happen. The > > message definitely needs to be sent to get corrupted, and it only seems to be > corrupt on the receiving end if (1) a mail server mangled the line endings > or (2) the receiving end decodes with a different line ending than the > original > file had. The receiving end doesn't need to be an Exchange server (we don't > use one and have a lot of problems with AOL recipients) nor does the recipient > > have to use Outlook (again, AOL users). > > I guess I'm just wondering how Acrobat encodes its streams differently to have > > a higher non-7-bit ratio and if there's an easy way to do the same thing in > RL. > > Thanks, > We explicitly put some non-8 bit characters right at the front in a comment. eg %PDF-1.3 %???? ReportLab Generated PDF document http://www.reportlab.com according to Andy that's some bit of shift-jis or something. I guess the ratio here is pretty small. Can you try an experiment and modify the code in pdfgen/pdfdoc.py (near line 853) that looks like PDFHeader = ( "%PDF-1.3"+LINEEND+ "%\223\214\213\236 ReportLab Generated PDF document http://www.reportlab.com"+LINEEND) to increase the number of eight bit chars? -- Robin Becker From andy at reportlab.com Tue May 5 09:33:01 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 5 May 2009 14:33:01 +0100 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <4A0039AC.6070903@chamonix.reportlab.co.uk> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> <002501c9cd7d$f232ee80$0502000a@ad.altalang.com> <4A0039AC.6070903@chamonix.reportlab.co.uk> Message-ID: <956003ae0905050633wbd94540l9d3b79d42fd376c3@mail.gmail.com> 2009/5/5 Robin Becker : > %PDF-1.3 > %???? ReportLab Generated PDF document http://www.reportlab.com > > according to Andy that's some bit of shift-jis or something. I guess the > ratio here is pretty small. It's the characters for 'Tokyo' in shift-jis. The rationale was a statement in the PDF spec that you ought to have some non-ascii early in the document to tell 'various communications channels' not to corrupt it; coupled with the using well-known Kanji so that I could tell if it had been converted to another encoding. These are just comments, so I go with Robin's suggestion: if a slightly longer 8-bit comment at the top fixes it, that's a low-risk change we can adopt easily. - Andy From yroman-reportlab at altalang.com Tue May 5 12:12:09 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Tue, 5 May 2009 12:12:09 -0400 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <956003ae0905050633wbd94540l9d3b79d42fd376c3@mail.gmail.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com><956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com><002501c9cd7d$f232ee80$0502000a@ad.altalang.com><4A0039AC.6070903@chamonix.reportlab.co.uk> <956003ae0905050633wbd94540l9d3b79d42fd376c3@mail.gmail.com> Message-ID: <00b901c9cd9c$3e0643c0$0502000a@ad.altalang.com> > These are just comments, so I go with Robin's suggestion: if a > slightly longer 8-bit comment at the top fixes it, that's a > low-risk change we can adopt easily. I tried this out, increasing the 8-bit comment so that the ratio of the RL document was under Acrobat's 81%. Unfortunately, that didn't seem to do anything. I did get Outlook to switch to base64 when the comment got the 7-bit characters down to 76%, but it was ridiculously long at that point. There seems to be more to Outlook's encoding decision than just the ratio. I came up with 2 other possible approaches: 1. Add a flag to use just LF as LINEEND. Outlook decides to encode all newlines when it doesn't see CR + LF. I *believe* the non-encoded newlines are the problem in the first place. 2. Add a flag to disable Ascii 85 encoding. That causes the 7-bit ratio to drop way below what Acrobat even had, partly because RL doesn't have the XML metatdata at the end. As a side benefit, the file size also drops. I made a first pass at #2. It was pretty easy to implement and did the trick for Outlook. Before I spend any more time on this, is there a reason for the A85 encoding? If not, is there a patch already out there to disable this? Thanks! -- Yoann Roman From andy at reportlab.com Tue May 5 16:54:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 5 May 2009 21:54:25 +0100 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <00b901c9cd9c$3e0643c0$0502000a@ad.altalang.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com> <956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com> <002501c9cd7d$f232ee80$0502000a@ad.altalang.com> <4A0039AC.6070903@chamonix.reportlab.co.uk> <956003ae0905050633wbd94540l9d3b79d42fd376c3@mail.gmail.com> <00b901c9cd9c$3e0643c0$0502000a@ad.altalang.com> Message-ID: <956003ae0905051354h630fbfa7ra8a74aa0ef8e4921@mail.gmail.com> 2009/5/5 Yoann Roman : > I made a first pass at #2. It was pretty easy to implement and did the > trick for Outlook. Before I spend any more time on this, is there a > reason for the A85 encoding? If not, is there a patch already out there > to disable this? When I wrote the very first version (1998?), I used to run 'Hello world' files through Distiller and see what came out. Ascii base 85 seemed to be in vogue then so I went for that, as it was more compact than base 64. The available filters are listed in section 7.4 on the PDF 1.7 spec (the ISO one, and the most readable version by far) here.. http://www.adobe.com/devnet/pdf/pdf_reference.html Since the 'stuff being encoded' is usually postscript-like graphics instructions which are mostly 7-bit ASCII, I think that just 'not encoding it' would not help, and would leave it vulnerable to even more corruption during transmission. However, just using FlateFilter (basically using gzip.compress) without the Ascii85 would yield a nicely binary stream. LF versus CRLF again came from looking at what Distiller produced. But maybe a better approach is to get rid of 95% the "line wrapping" altogether. I went to significant lengths to make sure the raw PDF files were "readable" in an editor, wrapping in sensible places, because we spent a LOT of time from 1998-2003 staring at the innards of PDF files. It would be very easy to "not line-wrap" much of the content. Maybe Outlook is noticing the formatting more than the coding when assuming this is text. In summary, let's look at a 'binary' option which does both, and see if that fools Outlook. - Andy From yroman-reportlab at altalang.com Tue May 5 18:06:02 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Tue, 5 May 2009 18:06:02 -0400 Subject: [reportlab-users] Reducing use of 7-bit characters In-Reply-To: <956003ae0905051354h630fbfa7ra8a74aa0ef8e4921@mail.gmail.com> References: <00e501c9cce9$1d991df0$0502000a@ad.altalang.com><956003ae0905042341m7f5358b1m8ce73ebd55c5901a@mail.gmail.com><002501c9cd7d$f232ee80$0502000a@ad.altalang.com><4A0039AC.6070903@chamonix.reportlab.co.uk><956003ae0905050633wbd94540l9d3b79d42fd376c3@mail.gmail.com><00b901c9cd9c$3e0643c0$0502000a@ad.altalang.com> <956003ae0905051354h630fbfa7ra8a74aa0ef8e4921@mail.gmail.com> Message-ID: <00f401c9cdcd$addc5e60$0502000a@ad.altalang.com> > However, just using FlateFilter (basically using gzip.compress) > without the Ascii85 would yield a nicely binary stream. That's essentially what my first pass at making Ascii85 did. Acrobat 9 didn't have any problems with it, but I know it's lenient. Outlook encoded this as base64 with no transmission problems. > LF versus CRLF again came from looking at what Distiller > produced. But maybe a better approach is to get rid of 95% > the "line wrapping" altogether. The only "line wrapping" I see is with the non-encoded PDF markup. I don't have wrapA85 on, though, but I thought that was off by default. > I went to significant lengths to make sure the raw PDF files were > "readable" in an editor, wrapping in sensible places, because we > spent a LOT of time from 1998-2003 staring at the innards of PDF > files. It would be very easy to "not line-wrap" much > of the content. Maybe Outlook is noticing the formatting more than > the coding when assuming this is text. I can't claim to know what Outlook is doing, but I did do a trial removing all newlines; Outlook still encoded it quoted-printable. I would definitely make turning off these things optional so that they don't affect anyone else and can be turned back on for debugging. I really appreciated the fact that I could "see" problems in my PDFs. > In summary, let's look at a 'binary' option which does both, > and see if that fools Outlook. Turning off Ascii85 definitely does. The CRLF change doesn't seem to, but at least Outlook encodes the newlines, which it should help. When you say "let's look", does that mean internal to ReportLab? Thanks for the detailed explanation, -- Yoann Roman From gherman at darwin.in-berlin.de Wed May 6 15:22:32 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 6 May 2009 21:22:32 +0200 Subject: [reportlab-users] Keeping track of page breaks in tables Message-ID: Hi, In a project using PDF backdrops combined via pyPdf with dynamically generated PDF I need to select the backdrop pages from a multi-page PDF file based on the current content. So I need to know how many page breaks a table generates - but without running multiple render- ing passes. I wonder what the best strategy would be for doing this? Thanks, Dinu From robin at reportlab.com Thu May 7 04:44:14 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 07 May 2009 09:44:14 +0100 Subject: [reportlab-users] Keeping track of page breaks in tables In-Reply-To: References: Message-ID: <4A029F5E.5090803@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Hi, > > In a project using PDF backdrops combined via pyPdf with dynamically > generated PDF I need to select the backdrop pages from a multi-page > PDF file based on the current content. So I need to know how many > page breaks a table generates - but without running multiple render- > ing passes. I wonder what the best strategy would be for doing this? > > Thanks, > > Dinu ......... well you could render just the table using a fake frame set; that's effectively the only way to know how long it's going to be unless the table structure is re ally simple and computable. Is it actually the best strategy though? The reportlab doctemplate provides hooks to let you know when pages have changed so in the RL world you just slurp in the page from the PDF before allowing the rest of the story to be handled. -- Robin Becker From andy at reportlab.com Thu May 7 05:18:35 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 7 May 2009 10:18:35 +0100 Subject: [reportlab-users] Keeping track of page breaks in tables In-Reply-To: <4A029F5E.5090803@chamonix.reportlab.co.uk> References: <4A029F5E.5090803@chamonix.reportlab.co.uk> Message-ID: <956003ae0905070218j298cfd37r5b3f20f9a22f1091@mail.gmail.com> 2009/5/7 Robin Becker : > Is it actually the best strategy though? The reportlab doctemplate provides > hooks to let you know when pages have changed so in the RL world you just > slurp in the page from the PDF before allowing the rest of the story to be > handled. It's easy to have doctemplate hooks so you know the page numbers, but if you need to know when a table begins and ends rendering then you might want to write a custom 'notification flowable' and put one in the story before and after your table. This would consume no space and would just look at the canvas and record the page number. Or, you could put it in the first and last table cells. Not tested but something like.... class NotificationFlowable(Flowable): def wrap(self, availWidth, availHeight): return 0, 0 def draw(self, canv): tellDinu(canv.pageNumber) - Andy From sam.blackmore at gmail.com Mon May 11 22:59:47 2009 From: sam.blackmore at gmail.com (Sam) Date: Tue, 12 May 2009 14:59:47 +1200 Subject: [reportlab-users] easy_install problem? Message-ID: Hello everyone, I having problems install reportlab using easy_install - this is a production server so I'd like to be sure of the correct way of doing it before I proceed. I can't apt-get install python-reportlab as I'm on Debian lenny (5.0 ) and reportlab is at version 2.1 (http://packages.debian.org/lenny/python-reportlab) whereas I need version 2.2+ for Pisa (xhtml2pdf) . Can anyone suggest how to navigate this problem. Many thanks in advance. Sam webserver:/home/domains# easy_install reportlab Searching for reportlab Reading http://pypi.python.org/simple/reportlab/ Reading http://www.reportlab.com/ Best match: reportLab 2.3 Downloading http://pypi.python.org/packages/source/r/reportlab/reportLab-2.3.zip#md5=7d98b26fa287a9e4be4d35d682ce64ac Processing reportLab-2.3.zip Running ReportLab_2_3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Q0EUXI/ReportLab_2_3/egg-dist-tmp-oR-wnw ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/renderPM' # installing without freetype no ttf, sorry! ################################################ /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function 'hex32': /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:793: warning: format '%8.8X' expects type 'unsigned int', but argument 3 has type 'long unsigned int' /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function '_instanceStringWidthU': /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1200: warning: pointer targets in assignment differ in signedness /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function 'Box_set_character': /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1393: warning: format '%d' expects type 'int', but argument 3 has type 'Py_ssize_t' /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function '_instanceStringWidthU': /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: 'f' may be used uninitialized in this function /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: 't' may be used uninitialized in this function /tmp/easy_install-Q0EUXI/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: 'L' may be used uninitialized in this function /usr/bin/ld: cannot find -l_renderPM_libart webserver:/home/domains# ls -l /usr/lib/lib*ren* lrwxrwxrwx 1 root root 19 Mar 19 11:21 /usr/lib/libXrender.so.1 -> libXrender.so.1.3.0 -rw-r--r-- 1 root root 38296 Jun 14 2008 /usr/lib/libXrender.so.1.3.0 lrwxrwxrwx 1 root root 27 Mar 19 11:21 /usr/lib/libxcb-render-util.so.0 -> libxcb-render-util.so.0.0.0 -rw-r--r-- 1 root root 12888 Aug 7 2008 /usr/lib/libxcb-render-util.so.0.0.0 lrwxrwxrwx 1 root root 22 Mar 19 11:21 /usr/lib/libxcb-render.so.0 -> libxcb-render.so.0.0.0 -rw-r--r-- 1 root root 33304 Jun 4 2008 /usr/lib/libxcb-render.so.0.0.0 Sam From andy at reportlab.com Tue May 12 03:38:35 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 12 May 2009 08:38:35 +0100 Subject: [reportlab-users] easy_install problem? In-Reply-To: References: Message-ID: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> 2009/5/12 Sam : > Hello everyone, > > I having problems install reportlab using easy_install We don't support easy_install yet. The correct approach is "python setup.py install"; see the INSTALL.txt inside the distribution. Even if we did change our distro to support easy_install, a proper installation ideallly requires both FreeType 6 and PIL compiled to use it, and easy_install can't control the various compilers to that degree. So we prefer people to download the tgz and follow the instructions. Best Regards, Andy Robinson From sam.blackmore at gmail.com Tue May 12 17:41:14 2009 From: sam.blackmore at gmail.com (Sam) Date: Wed, 13 May 2009 09:41:14 +1200 Subject: [reportlab-users] easy_install problem? In-Reply-To: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> References: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> Message-ID: Hi Andy, Thanks for the reply. I've just tried to install from source but am getting a single failure from the preinstall tests. Is there something that I'm missing? webserver:/home/domains/pisa_install/ReportLab_2_3# python setup.py tests-preinstall .........Traceback (most recent call last): File "genreference.py", line 31, in run() File "genreference.py", line 17, in run yaml2pdf.run('reference.yml','reportlab-reference.pdf') File "/home/domains/pisa_install/ReportLab_2_3/tools/docco/yaml2pdf.py", line 54, in run story.append(Paragraph(text, style, bulletText=bulletText)) File "/home/domains/pisa_install/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 798, in __init__ self._setup(text, style, bulletText, frags, cleanBlockQuotedText) File "/home/domains/pisa_install/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 816, in _setup % (_parser.errors[0],text[:min(30,len(text))])) ValueError: xml parser error (garbage in start tag) in paragraph beginning 'Very simple and fast XML parse' Failed to import renderPM. F............................................................................................................................................................................ ====================================================================== FAIL: Test if all manuals buildable from source. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/domains/pisa_install/ReportLab_2_3/tests/test_docs_build.py", line 32, in test0 assert os.path.isfile('reportlab-reference.pdf'), 'genAll.py failed to generate reportlab-reference.pdf!' AssertionError: genAll.py failed to generate reportlab-reference.pdf! ---------------------------------------------------------------------- Ran 182 tests in 63.952s FAILED (failures=1) Many thanks again. Sam 2009/5/12 Andy Robinson : > 2009/5/12 Sam : >> Hello everyone, >> >> I having problems install reportlab using easy_install > > We don't support easy_install yet. ? The correct approach > is "python setup.py install"; see the INSTALL.txt inside the > distribution. > > Even if we did change our distro to support easy_install, > a proper installation ideallly requires both FreeType 6 > and PIL compiled to use it, and easy_install can't > control the various compilers to that degree. ?So we > prefer people to download the tgz and follow the instructions. > > Best Regards, > > > Andy Robinson > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From andy at reportlab.com Tue May 12 18:32:04 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 12 May 2009 23:32:04 +0100 Subject: [reportlab-users] easy_install problem? In-Reply-To: References: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> Message-ID: <956003ae0905121532p75585b65lc7127637190b9e26@mail.gmail.com> 009/5/12 Sam : > Hi Andy, > > Thanks for the reply. I've just tried to install from source but am > getting a single failure from the preinstall tests. Is there something > that I'm missing? No, it's normal for the tests requiring the C libraries to fail until those C libraries have been compiled. Go ahead with 'setup.py install' then run tests again, and it should be clean. There's a good reason for this pre-install test but it wasn't explained properly in the install file, which we will improve on the next release. - Andy From sam.blackmore at gmail.com Tue May 12 18:39:43 2009 From: sam.blackmore at gmail.com (Sam) Date: Wed, 13 May 2009 10:39:43 +1200 Subject: [reportlab-users] easy_install problem? In-Reply-To: <956003ae0905121532p75585b65lc7127637190b9e26@mail.gmail.com> References: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> <956003ae0905121532p75585b65lc7127637190b9e26@mail.gmail.com> Message-ID: Many thanks Andy - installation went smoothly. Sam 2009/5/13 Andy Robinson : > 009/5/12 Sam : >> Hi Andy, >> >> Thanks for the reply. I've just tried to install from source but am >> getting a single failure from the preinstall tests. Is there something >> that I'm missing? > > No, it's normal for the tests requiring the C libraries to fail until > those C libraries have been compiled. ?Go ahead with 'setup.py > install' then run tests again, and it should be clean. > > There's a good reason for this pre-install test but it wasn't > explained properly in the install file, which we will improve on the > next release. > > - Andy > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From marius at gedmin.as Wed May 13 11:08:07 2009 From: marius at gedmin.as (Marius Gedminas) Date: Wed, 13 May 2009 18:08:07 +0300 Subject: [reportlab-users] easy_install problem? In-Reply-To: References: <956003ae0905120038x79e07ef1te886bef7fe4868dc@mail.gmail.com> Message-ID: <20090513150807.GB14564@platonas> On Wed, May 13, 2009 at 09:41:14AM +1200, Sam wrote: > Thanks for the reply. I've just tried to install from source but am > getting a single failure from the preinstall tests. Is there something > that I'm missing? > > webserver:/home/domains/pisa_install/ReportLab_2_3# python setup.py > tests-preinstall > .........Traceback (most recent call last): > File "genreference.py", line 31, in > run() > File "genreference.py", line 17, in run > yaml2pdf.run('reference.yml','reportlab-reference.pdf') > File "/home/domains/pisa_install/ReportLab_2_3/tools/docco/yaml2pdf.py", > line 54, in run > story.append(Paragraph(text, style, bulletText=bulletText)) > File "/home/domains/pisa_install/ReportLab_2_3/src/reportlab/platypus/paragraph.py", > line 798, in __init__ > self._setup(text, style, bulletText, frags, cleanBlockQuotedText) > File "/home/domains/pisa_install/ReportLab_2_3/src/reportlab/platypus/paragraph.py", > line 816, in _setup > % (_parser.errors[0],text[:min(30,len(text))])) > ValueError: xml parser error (garbage in start tag) in paragraph beginning > 'Very simple and fast XML parse' I don't know if this is the same error you're seeing, but I've discovered that ReportLab has two different XML parsers: one is based on the old Python XML tools (sgmlop, specifically), and the other is a fallback one written in Python. They behave differently when they encounter ill-formed XML markup (the Python-based parser is more strict). BTW Debian is trying to phase out python-xml (since it's not maintained upstream). Marius Gedminas -- Only great masters of style can succeed in being obtuse. -- Oscar Wilde Most UNIX programmers are great masters of style. -- The Unnamed Usenetter -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From marius at gedmin.as Thu May 14 10:48:25 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 14 May 2009 17:48:25 +0300 Subject: [reportlab-users] Release notes on the website Message-ID: <20090514144825.GA26101@platonas> I was looking for a web page outlining the differences between ReportLab 2.0 and 2.1 (yes, we still use 2.0 in production, shame on us), and found this: http://www.reportlab.org/relnotes.html It speaks about 1.20 released back in 2004 and a possible "version 2.0". It also links to http://developer.reportlab.com/relnotes.html which has the same outdated information. (At least http://www.reportlab.org/rl_toolkit.html itself provides quick links to what's new in 2.3, 2.2 and 2.0 -- but not in 2.1.) Marius Gedminas -- A secret: don't tell DARPA I'm not building the sun destroying weapon they think I am. -- Michael Salib, the author of Starkiller -------------- 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 Thu May 14 11:34:04 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 14 May 2009 16:34:04 +0100 Subject: [reportlab-users] Release notes on the website In-Reply-To: <20090514144825.GA26101@platonas> References: <20090514144825.GA26101@platonas> Message-ID: <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> 2009/5/14 Marius Gedminas : > I was looking for a web page outlining the differences between ReportLab > 2.0 and 2.1 (yes, we still use 2.0 in production, shame on us), and > found this: http://www.reportlab.org/relnotes.html Funnily enough I've just come out of a meeting discussing the desperate need to revive our stalled project to replace www.reportlab.org with a much better site. This page is not linked from the menus, and ought to be removed. The first sentence ("We release every 2-3 months") is probably the biggest lie but thanks for reminding us! With 2.1, I am embarrassed to say no such document exists. We went a LONG time between releases without having a high-level changes list or documentation, and all we could really say is that it was "18 months worth of bug fixes and minor enhancements". The best we could do was a huge report out of the subversion logs. For completeness' sake we should have a page for 2.1 which at least says this. In any event, if upgrading I would recommend to go for the latest release version (2.3). - Andy From marius at gedmin.as Thu May 14 13:25:48 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 14 May 2009 20:25:48 +0300 Subject: [reportlab-users] Release notes on the website In-Reply-To: <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> References: <20090514144825.GA26101@platonas> <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> Message-ID: <20090514172548.GB32438@platonas> On Thu, May 14, 2009 at 04:34:04PM +0100, Andy Robinson wrote: > 2009/5/14 Marius Gedminas : > > I was looking for a web page outlining the differences between ReportLab > > 2.0 and 2.1 (yes, we still use 2.0 in production, shame on us), and > > found this: http://www.reportlab.org/relnotes.html > > Funnily enough I've just come out of a meeting discussing the > desperate need to revive our stalled project to replace > www.reportlab.org with a much better site. > > This page is not linked from the menus, and ought to be removed. (I'm not sure what "menus" are, but I found that page by clicking on a series of hyperlinks starting from the reportlab.com front page.) > The > first sentence ("We release every 2-3 months") is probably the biggest > lie but thanks for reminding us! > > With 2.1, I am embarrassed to say no such document exists. We went a > LONG time between releases without having a high-level changes list or > documentation, and all we could really say is that it was "18 months > worth of bug fixes and minor enhancements". The best we could do > was a huge report out of the subversion logs. For completeness' > sake we should have a page for 2.1 which at least says this. I found the file called 'changes' (unexpectedly lowercase for a Unixy person like me, but it's a .zip file, so it figures) in the .zip files. I can try to summarize: * bugfixes * corrected text justification (yes! /me happy!) * support for strike-through * support for
and in paragraphs * Bitstream Vera TrueType fonts added to the distribution * compatibility fixes for Python 2.3 and 2.5 There was some mention about TTF checksums in the changelog. Was 2.1 the first release that replaced the old and *terribly* slow Python checksumming code with an accelerated C version? That'd be worth mentioning. There were some changes related to character spacing or perhaps kerning, but I haven't noticed anything pertinent in the changelog. Compare: http://mg.pov.lt/reportlab/2.0/test-empty-pdr-0.png http://mg.pov.lt/reportlab/2.1/test-empty-pdr-0.png Here are the differences highlighted: http://mg.pov.lt/reportlab/diff-2.0-vs-2.1/test-empty-pdr-0.png > In any event, if upgrading I would recommend to go for the latest > release version (2.3). Unfortunately 2.2 changes vertical positioning of paragraphs in a way that breaks out reports. Compare: http://mg.pov.lt/reportlab/2.1/test-empty-pdr-0.png http://mg.pov.lt/reportlab/2.2/test-empty-pdr-0.png http://mg.pov.lt/reportlab/diff-2.1-vs-2.2/test-empty-pdr-0.png 2.3 produces the same output as 2.2. I haven't figured out yet whether the bug is in our code, or in ReportLab. The text that remains in the same position is drawn with canvas.drawString(x, y, "string") The large title text that is now shifted up is drawn with para = Paragraph("string", style) para.wrap(PAGE_WIDTH - x * 2, PAGE_HEIGHT) y -= para.height/2 para.drawOn(canvas, x, y) The same vertical shift up happens everywhere Paragraphs are used, e.g. tables containing Paragraphs inside table cells (also visible in that image). It also happens to flowables added to the story, i.e. the first paragraph on every page is shifted up: http://mg.pov.lt/reportlab/2.1/test-empty-pdr-1.png http://mg.pov.lt/reportlab/2.2/test-empty-pdr-1.png http://mg.pov.lt/reportlab/diff-2.1-vs-2.2/test-empty-pdr-1.png Marius Gedminas -- Hoping the problem magically goes away by ignoring it is the "microsoft approach to programming" and should never be allowed. -- Linus Torvalds -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From ralsina at netmanagers.com.ar Thu May 14 22:57:20 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 14 May 2009 23:57:20 -0300 Subject: [reportlab-users] Announce: rst2pdf 0.10 released Message-ID: <200905142357.21351.ralsina@netmanagers.com.ar> It's my pleasure to announce the release of rst2pdf version 0.10. This version includes many bugfixes and some new features compared to the previous 0.9 version. Rst2pdf is a tool to generate PDF files directly from restructured text sources via reportlab. It 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.9: * Issue 87: Table headers can be repeated in each page (thanks to Yasushi Masuda) * Issue 93: Line number support for code blocks (:linenos: true) * Issue 111: Added --no-footnote-backlinks option * Issue 107: Support localized directives/roles (example: sommaire instead of contents) * Issue 112: Fixed crash when processing empty list items * Issue 98: Nobreak support, and set as default for inline-literals so they don't hyphenate. * Slightly better tests * Background colors in text styles work with reportlab 2.3 * Issue 99: Fixed hyphenation in headers/footers (requires wordaxe 0.3.2) * Issue 106: Crash on demo.txt fixed (requires wordxe 0.3.2) * Issue 102: Implemented styles for bulleted and numbered lists * Issue 38: Default headers/footers via options, config file or stylesheet * Issue 88: Implemented much better book-style TOCs * Issue 100: Fixed bug with headers/footers and Reportlab 2.3 * Issue 95: Fixed bug with indented tables * Issue 89: Implemented --version * Issue 84: Fixed bug with relative include paths * Issue 85: Fixed bug with table cell styles * Issue 83: Fixed bug with numeric colors in backColor attribute * Issue 44: Support for stdin and stdout * Issue 79: Added --stylesheet-path option * Issue 80: Send warnings to stderr, not stdout * Issue 66: Implemented "smart quotes" * Issue 77: Work around missing matplotlib * Proper translation of labels (such as "Author", "Version" etc.) using the docutils languages package. (r473) * Fixed problems with wrong or non-existing fonts. (r484) * Page transition effect support for presentations (r423) I hope you enjoy this software! -- ("\''/").__..-''"`-. . 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 tim at reportlab.com Fri May 15 04:39:10 2009 From: tim at reportlab.com (Tim Grant) Date: Fri, 15 May 2009 09:39:10 +0100 Subject: [reportlab-users] Release notes on the website In-Reply-To: <20090514144825.GA26101@platonas> References: <20090514144825.GA26101@platonas> Message-ID: <4A0D2A2E.4050206@reportlab.com> The links have now been fixed; thanks for pointing them out. The v2.1 release notes may follow at some point. Tim Grant ReportLab Europe Ltd. Media House 3 Palmerston Road London SW19 1PG Tel +44-20-8545-1570 Marius Gedminas wrote: > I was looking for a web page outlining the differences between ReportLab > 2.0 and 2.1 (yes, we still use 2.0 in production, shame on us), and > found this: http://www.reportlab.org/relnotes.html > > It speaks about 1.20 released back in 2004 and a possible "version 2.0". > It also links to http://developer.reportlab.com/relnotes.html which has > the same outdated information. > > (At least http://www.reportlab.org/rl_toolkit.html itself provides quick > links to what's new in 2.3, 2.2 and 2.0 -- but not in 2.1.) > > Marius Gedminas > > > ------------------------------------------------------------------------ > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From timr at probo.com Fri May 15 13:11:21 2009 From: timr at probo.com (Tim Roberts) Date: Fri, 15 May 2009 10:11:21 -0700 Subject: [reportlab-users] Release notes on the website In-Reply-To: <4A0D2A2E.4050206@reportlab.com> References: <20090514144825.GA26101@platonas> <4A0D2A2E.4050206@reportlab.com> Message-ID: <4A0DA239.5030200@probo.com> Tim Grant wrote: > The links have now been fixed; thanks for pointing them out. The v2.1 > release notes may follow at some point. > > Tim Grant > ReportLab Europe Ltd. That's a name I've not seen before -- just Andy and Robin. Are you new, or have you just managed to avoid the mailing list until you got sucked in to handle the web issues? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From ralsina at netmanagers.com.ar Sat May 16 17:57:41 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sat, 16 May 2009 18:57:41 -0300 Subject: [reportlab-users] A bug using Message-ID: <200905161857.42134.ralsina@netmanagers.com.ar> I got this bug report for rst2pdf, but I was able to reproduce it using just reportlab: http://code.google.com/p/rst2pdf/issues/detail?id=113 Basically, a paragraph containing draws the image above the previous paragraph. The text is there, but it's under the image. It should be possible to reproduce with almost any image, but you can get thanks.png here: http://rst2pdf.googlecode.com/issues/attachment?aid=9059379037914234984&name=thanks.png And here is my reportlab program to reproduce it: from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import getSampleStyleSheet styles = getSampleStyleSheet() def go(): Story=[] doc = SimpleDocTemplate("phello.pdf") style = styles["Normal"] p = Paragraph('This should be above the image', style) Story.append(p) p = Paragraph('', style) Story.append(p) p = Paragraph('This should be below the image', style) Story.append(p) doc.build(Story) go() -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) "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 Sun May 17 08:05:12 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sun, 17 May 2009 09:05:12 -0300 Subject: [reportlab-users] Announce: rst2pdf 0.10.1 released Message-ID: <200905170905.12811.ralsina@netmanagers.com.ar> This is basically the same announcement as for version 0.10 from a few days ago, with this extra notice: This time, the release packages actually work. 0.10 was released with broken tarballs that didn't install critical files because of a bug in setup.py. As a bonus, there is exactly one (1) more bug fixed in 0.10.1, about PDF TOCs created from titles containing the "&<>" characters. Below, the original announcement: ----------------------- It's my pleasure to announce the release of rst2pdf version 0.10.1. This version includes many bugfixes and some new features compared to the previous 0.9 version. Rst2pdf is a tool to generate PDF files directly from restructured text sources via reportlab. It 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.9: * Issue 87: Table headers can be repeated in each page (thanks to Yasushi Masuda) * Issue 93: Line number support for code blocks (:linenos: true) * Issue 111: Added --no-footnote-backlinks option * Issue 107: Support localized directives/roles (example: sommaire instead of contents) * Issue 112: Fixed crash when processing empty list items * Issue 98: Nobreak support, and set as default for inline-literals so they don't hyphenate. * Slightly better tests * Background colors in text styles work with reportlab 2.3 * Issue 99: Fixed hyphenation in headers/footers (requires wordaxe 0.3.2) * Issue 106: Crash on demo.txt fixed (requires wordxe 0.3.2) * Issue 102: Implemented styles for bulleted and numbered lists * Issue 38: Default headers/footers via options, config file or stylesheet * Issue 88: Implemented much better book-style TOCs * Issue 100: Fixed bug with headers/footers and Reportlab 2.3 * Issue 95: Fixed bug with indented tables * Issue 89: Implemented --version * Issue 84: Fixed bug with relative include paths * Issue 85: Fixed bug with table cell styles * Issue 83: Fixed bug with numeric colors in backColor attribute * Issue 44: Support for stdin and stdout * Issue 79: Added --stylesheet-path option * Issue 80: Send warnings to stderr, not stdout * Issue 66: Implemented "smart quotes" * Issue 77: Work around missing matplotlib * Proper translation of labels (such as "Author", "Version" etc.) using the docutils languages package. (r473) * Fixed problems with wrong or non-existing fonts. (r484) * Page transition effect support for presentations (r423) I hope you enjoy this software! -- ("\''/").__..-''"`-. . 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 Sun May 17 09:33:45 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sun, 17 May 2009 10:33:45 -0300 Subject: [reportlab-users] TOC depth limits Message-ID: <200905171033.45502.ralsina@netmanagers.com.ar> Just a note from another bug report in rst2pdf which may be useful for reportlab: Apparently there are documents with sub sub sub sub sub sections, and reportlab will not let me build a TOC for them because there are only 4 levels of styles in TableOfContents.levelStyles and then it fails. I patched it on rst2pdf's side the obvious way adding extra styles to that list, but maybe this could be raised 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 jonas at reportlab.com Mon May 18 06:16:08 2009 From: jonas at reportlab.com (jonas wustrack) Date: Mon, 18 May 2009 11:16:08 +0100 Subject: [reportlab-users] TOC depth limits In-Reply-To: <200905171033.45502.ralsina@netmanagers.com.ar> References: <200905171033.45502.ralsina@netmanagers.com.ar> Message-ID: This should now be fixed in the trunk. The code now generates styles for a theoretically infinite amount of levels when needed, indenting them a bit more at each step. The four first styles should still be the same as before. -- Jonas Wustrack Software Developer ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 On Sun, May 17, 2009 at 2:33 PM, Roberto Alsina wrote: > Just a note from another bug report in rst2pdf which may be useful for > reportlab: > > Apparently there are documents with sub sub sub sub sub sections, and > reportlab will not let me build a TOC for them because there are only 4 levels > of styles in TableOfContents.levelStyles and then it fails. > > I patched it on rst2pdf's side the obvious way adding extra styles to that > list, but maybe this could be raised 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From ralsina at netmanagers.com.ar Mon May 18 06:49:39 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 18 May 2009 07:49:39 -0300 Subject: [reportlab-users] TOC depth limits In-Reply-To: References: <200905171033.45502.ralsina@netmanagers.com.ar> Message-ID: <200905180749.39822.ralsina@netmanagers.com.ar> On Monday 18 May 2009 07:16:08 jonas wustrack wrote: > This should now be fixed in the trunk. The code now generates styles > for a theoretically infinite amount of levels when needed, indenting > them a bit more at each step. > The four first styles should still be the same as before. Cool. > > -- > Jonas Wustrack > Software Developer > ReportLab Europe Ltd. > Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK > Tel +44-20-8545-1570 > > On Sun, May 17, 2009 at 2:33 PM, Roberto Alsina > > wrote: > > Just a note from another bug report in rst2pdf which may be useful for > > reportlab: > > > > Apparently there are documents with sub sub sub sub sub sections, and > > reportlab will not let me build a TOC for them because there are only 4 > > levels of styles in TableOfContents.levelStyles and then it fails. > > > > I patched it on rst2pdf's side the obvious way adding extra styles to > > that list, but maybe this could be raised 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 > > _______________________________________________ > > 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 -- ("\''/").__..-''"`-. . 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 Mon May 18 21:42:33 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 18 May 2009 22:42:33 -0300 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 Message-ID: <200905182242.33414.ralsina@netmanagers.com.ar> Also, reportlab.__version__ is the same. That means it's impossible to tell between 2.3 and SVN trunk, so my fix for deep TOCs breaks when used with SVN. I'll work around it by catching the exception, but it would be nicer if there was a way to tell with a nice if. 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 hongyuan1306 at gmail.com Tue May 19 03:08:07 2009 From: hongyuan1306 at gmail.com (Yuan HOng) Date: Tue, 19 May 2009 15:08:07 +0800 Subject: [reportlab-users] PDF creation, z3c.rml and TOCs... In-Reply-To: <49EC9CD2.2030902@kencorey.com> References: <49EC9CD2.2030902@kencorey.com> Message-ID: <91320d220905190008h7ad03f95u34db3a150ee99e66@mail.gmail.com> On Tue, Apr 21, 2009 at 12:03 AM, Ken Corey wrote: > Hi All, > > I've spent a very interesting day reading through the documentation > regarding z3c.rml, (and the rml examples from reportlab once I found them), > and then trying to get z3c.rml working standalone. > > I checked out z3c.rml, Zope, zope.event, zope.i18nmessageid, > zope.interface, zope.schema. I changed all the references to lxml to > xml.etree.ElementTree, so that it might work on Google AppEngine. I set up > pythonpath to point the the (seemingly) appropriate places, and then tried > several times running rml2pdf.py with this command line: > > C:\Temp\z3c.rml\src\z3c\rml>python rml2pdf.py tests\input\simple-layout.rml > Traceback (most recent call last): > File "rml2pdf.py", line 25, in > import document, interfaces > File "C:\Temp\z3c.rml\src\z3c\rml\document.py", line 26, in > from z3c.rml import attr, directive, interfaces, occurence > File "c:\temp\z3c.rml\src\z3c\rml\attr.py", line 36, in > from z3c.rml import interfaces > File "c:\temp\z3c.rml\src\z3c\rml\interfaces.py", line 138, in > class IDeprecatedDirective(zope.interface.interfaces.IInterface): > AttributeError: 'module' object has no attribute 'interfaces' > > Do you know what that error means? All this 'Interface' stuff has me more > than a little bemused as a complete Python newbie. > > I think your zope.interface module is not installed properly. Try to install it use easy_install, like: c:\>easy_install zope.interface In fact, you'd better install all the zope packages using easy_install, including z3c.rml. -- Hong Yuan ????????? ??????????? http://www.homemaster.cn -------------- next part -------------- An HTML attachment was scrubbed... URL: From hongyuan1306 at gmail.com Tue May 19 04:23:59 2009 From: hongyuan1306 at gmail.com (Yuan HOng) Date: Tue, 19 May 2009 16:23:59 +0800 Subject: [reportlab-users] cjk word wrapping does not work with
? Message-ID: <91320d220905190123t4d2f32d1xf06a6fbee078b3ca@mail.gmail.com> With reportlab version 2.3, in a paragraph with wordWrap='CJK', all
tags are ignored. The test below shows a short sample and one can easily see the difference. from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import ParagraphStyle doc = SimpleDocTemplate("test.pdf") p = Paragraph(u'aaa
bbb',ParagraphStyle('s',wordWrap='CJK')) p1 = Paragraph(u'aaa
bbb',ParagraphStyle('s')) story = [p, p1] doc.build(story) I think this is a bug? -- Hong Yuan ????????? ??????????? http://www.homemaster.cn -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonas at reportlab.com Tue May 19 04:26:13 2009 From: jonas at reportlab.com (jonas wustrack) Date: Tue, 19 May 2009 09:26:13 +0100 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: <200905182242.33414.ralsina@netmanagers.com.ar> References: <200905182242.33414.ralsina@netmanagers.com.ar> Message-ID: I am a bit surprised that your fix breaks when used with the trunk. My change was meant to be backwards compatible. If you just added a list of styles to the defaultStyles attribute there should be no problem. Can you show me a traceback and possibly the source code of your fix? Thanks. On Tue, May 19, 2009 at 2:42 AM, Roberto Alsina wrote: > Also, reportlab.__version__ is the same. > > That means it's impossible to tell between 2.3 and SVN trunk, so my fix for > deep TOCs breaks when used with SVN. > > I'll work around it by catching the exception, but it would be nicer if there > was a way to tell with a nice if. > > 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 > _______________________________________________ > 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 hongyuan1306 at gmail.com Tue May 19 05:14:52 2009 From: hongyuan1306 at gmail.com (Yuan HOng) Date: Tue, 19 May 2009 17:14:52 +0800 Subject: [reportlab-users] Template examples? In-Reply-To: <49EB90C4.7050401@kencorey.com> References: <49EB90C4.7050401@kencorey.com> Message-ID: <91320d220905190214q36b1e9c4gef2a16f8c5da2e66@mail.gmail.com> > > > If anyone has any template classes like this that they'd care to share, > I've got *lots* to learn (just ask my wife...:^) > > Anyway, I also saw on a web page ( > http://achievewith.us/public/articles/2007/02/21/produce-pdf-pages-with-turbogears-cheetah-and-reportlab) > a tantalising discussion about a template built using a Cheetah templating > tool like so: > > some text... > > > Has anyone tried mixing reportlabs' PDF tool's templates and Cheetah > templates? Any thoughts on whether this would make it easier or harder than > reportlab's templates only? > > -Ken > > Have a look at z3c.rml, which uses the rml to describe a page. You can generate the rml file with your favorite template language. I use kid for instance. -- Hong Yuan ????????? ??????????? http://www.homemaster.cn -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Tue May 19 06:27:23 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 19 May 2009 07:27:23 -0300 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: References: <200905182242.33414.ralsina@netmanagers.com.ar> Message-ID: <200905190727.24125.ralsina@netmanagers.com.ar> On Tuesday 19 May 2009 05:26:13 jonas wustrack wrote: > I am a bit surprised that your fix breaks when used with the trunk. My > change was meant to be backwards compatible. > If you just added a list of styles to the defaultStyles attribute > there should be no problem. Can you show me a traceback and possibly > the source code of your fix? It's probably that my fix is not exactly awesome code ;-) My fix: # Issue 117: add extra TOC levelStyles. 9-deep should be enough. for i in range(4): ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), parent=toc.levelStyles[2], leading=toc.levelStyles[2].leading, firstlineIndent=toc.levelStyles[2].firstLineIndent, leftIndent=toc.levelStyles[-1].leftIndent+1*cm) toc.levelStyles.append(ps) Here is the error: ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), IndexError: list index out of range I understand in SVN I am supposed to use getLevelStyle(2) instead of levelStyles[2] but since that's not in 2.3 I still need to catch an exception. -- ("\''/").__..-''"`-. . 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 jonas at reportlab.com Tue May 19 06:46:56 2009 From: jonas at reportlab.com (jonas wustrack) Date: Tue, 19 May 2009 11:46:56 +0100 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: <200905190727.24125.ralsina@netmanagers.com.ar> References: <200905182242.33414.ralsina@netmanagers.com.ar> <200905190727.24125.ralsina@netmanagers.com.ar> Message-ID: I might be missing something, but why don't you just use levelStyles[-1] everywhere instead of levelStyles[2]? On Tue, May 19, 2009 at 11:27 AM, Roberto Alsina wrote: > On Tuesday 19 May 2009 05:26:13 jonas wustrack wrote: >> I am a bit surprised that your fix breaks when used with the trunk. My >> change was meant to be backwards compatible. >> If you just added a list of styles to the defaultStyles attribute >> there should be no problem. Can you show me a traceback and possibly >> the source code of your fix? > > It's probably that my fix is not exactly awesome code ;-) > > My fix: > > # Issue 117: add extra TOC levelStyles. 9-deep should be enough. > for i in range(4): > ? ? ? ?ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), > ? ? ? ? ? ? ? ?parent=toc.levelStyles[2], > ? ? ? ? ? ? ? ?leading=toc.levelStyles[2].leading, > ? ? ? ? ? ? ? ?firstlineIndent=toc.levelStyles[2].firstLineIndent, > ? ? ? ? ? ? ? ?leftIndent=toc.levelStyles[-1].leftIndent+1*cm) > ? ? ? ?toc.levelStyles.append(ps) > > Here is the error: > > ? ?ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), > IndexError: list index out of range > > I understand in SVN I am supposed to use getLevelStyle(2) instead of > levelStyles[2] but since that's not in 2.3 I still need to catch an exception. > > -- > ?("\''/").__..-''"`-. . ? ? ? ? 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 > -- 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 May 19 07:33:48 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 19 May 2009 12:33:48 +0100 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: <200905182242.33414.ralsina@netmanagers.com.ar> References: <200905182242.33414.ralsina@netmanagers.com.ar> Message-ID: <956003ae0905190433t4db9c13cya3657d40e3f6d6e0@mail.gmail.com> 2009/5/19 Roberto Alsina : > Also, reportlab.__version__ is the same. I just bumped reportlab.Version from "2.3" to "2.3+" in svn (reportlab + rlextra). We should have done this just after the release. No doubt this will mess up some release process or other - I guess I'll find out in the morning - but it was clearly lying. We also have reportlab.__version__ which is a hangover from our old CVS days and does not contain anything meaningful; in SVN it gets populated with the revision and last changed date of the module (__init__.py), so it's telling you when __init__.py changed, not the whole package. IMHO we should rip these things out but it won't happen today. Anyway I strongly suggest people use reportlab.Version for version-detection. Don't ask me why it has a capital V, I don't know... - Andy From ralsina at netmanagers.com.ar Tue May 19 08:17:11 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 19 May 2009 09:17:11 -0300 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: References: <200905182242.33414.ralsina@netmanagers.com.ar> <200905190727.24125.ralsina@netmanagers.com.ar> Message-ID: <200905190917.12080.ralsina@netmanagers.com.ar> On Tuesday 19 May 2009 07:46:56 jonas wustrack wrote: > I might be missing something, but why don't you just use > levelStyles[-1] everywhere instead of levelStyles[2]? I was trying to make it exactly as the styles reportlab created (thus the [2]), then I had to use -1 to get the correct leftIndent and never changed the rest of it ;-) Indeed if I use [-1] it works. I still need to tell SVN from 2.3 because we subclass TableOfContents and there is a leftColStyle = self.levelStyles[left_col_level] which needs to be changed to leftColStyle=self.getLevelStyle(left_col_level) > > On Tue, May 19, 2009 at 11:27 AM, Roberto Alsina > > wrote: > > On Tuesday 19 May 2009 05:26:13 jonas wustrack wrote: > >> I am a bit surprised that your fix breaks when used with the trunk. My > >> change was meant to be backwards compatible. > >> If you just added a list of styles to the defaultStyles attribute > >> there should be no problem. Can you show me a traceback and possibly > >> the source code of your fix? > > > > It's probably that my fix is not exactly awesome code ;-) > > > > My fix: > > > > # Issue 117: add extra TOC levelStyles. 9-deep should be enough. > > for i in range(4): > > ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), > > parent=toc.levelStyles[2], > > leading=toc.levelStyles[2].leading, > > firstlineIndent=toc.levelStyles[2].firstLineIndent, > > leftIndent=toc.levelStyles[-1].leftIndent+1*cm) > > toc.levelStyles.append(ps) > > > > Here is the error: > > > > ps=toc.levelStyles[2].__class__(name='Level%d'%(i+5), > > IndexError: list index out of range > > > > I understand in SVN I am supposed to use getLevelStyle(2) instead of > > levelStyles[2] but since that's not in 2.3 I still need to catch an > > exception. > > > > -- > > ("\''/").__..-''"`-. . 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 -- ("\''/").__..-''"`-. . 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 andy at reportlab.com Tue May 19 10:05:53 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 19 May 2009 15:05:53 +0100 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: <200905190917.12080.ralsina@netmanagers.com.ar> References: <200905182242.33414.ralsina@netmanagers.com.ar> <200905190727.24125.ralsina@netmanagers.com.ar> <200905190917.12080.ralsina@netmanagers.com.ar> Message-ID: <956003ae0905190705x65bedc3l654c2daf67ca040@mail.gmail.com> 2009/5/19 Roberto Alsina : > I still need to tell SVN from 2.3 because we subclass TableOfContents and > there is a As I said, I committed a fix an hour ago so that it's called "2.3+" at the moment. >>> import reportlab >>> reportlab.Version '2.3+' >>> We'll try to remember this after the next major release too.. - Andy From ralsina at netmanagers.com.ar Tue May 19 10:13:37 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 19 May 2009 11:13:37 -0300 Subject: [reportlab-users] SVN trunk reportlab.Version is the same as 2.3 In-Reply-To: <956003ae0905190705x65bedc3l654c2daf67ca040@mail.gmail.com> References: <200905182242.33414.ralsina@netmanagers.com.ar> <200905190917.12080.ralsina@netmanagers.com.ar> <956003ae0905190705x65bedc3l654c2daf67ca040@mail.gmail.com> Message-ID: <200905191113.38006.ralsina@netmanagers.com.ar> On Tuesday 19 May 2009 11:05:53 Andy Robinson wrote: > 2009/5/19 Roberto Alsina : > > I still need to tell SVN from 2.3 because we subclass TableOfContents and > > there is a > > As I said, I committed a fix an hour ago so that it's called "2.3+" at > the moment. Yup, mails crossed on their way. I am using Version again now. -- ("\''/").__..-''"`-. . 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 hongyuan1306 at gmail.com Tue May 19 21:57:35 2009 From: hongyuan1306 at gmail.com (Yuan HOng) Date: Wed, 20 May 2009 09:57:35 +0800 Subject: [reportlab-users] cjk word wrapping does not work with
? In-Reply-To: <91320d220905190123t4d2f32d1xf06a6fbee078b3ca@mail.gmail.com> References: <91320d220905190123t4d2f32d1xf06a6fbee078b3ca@mail.gmail.com> Message-ID: <91320d220905191857q139e24cbt2ee879e0a5b2138f@mail.gmail.com> I traced the bug to the function cjkFragSplit in module paragraph.py. Attached is my attempted patch, which seems to work. Please review. -- Hong Yuan ????????? ??????????? http://www.homemaster.cn -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: patch Type: application/octet-stream Size: 1487 bytes Desc: not available Url : From robin at reportlab.com Wed May 20 05:10:43 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 20 May 2009 10:10:43 +0100 Subject: [reportlab-users] cjk word wrapping does not work with
? In-Reply-To: <91320d220905191857q139e24cbt2ee879e0a5b2138f@mail.gmail.com> References: <91320d220905190123t4d2f32d1xf06a6fbee078b3ca@mail.gmail.com> <91320d220905191857q139e24cbt2ee879e0a5b2138f@mail.gmail.com> Message-ID: <4A13C913.4030804@chamonix.reportlab.co.uk> Yuan HOng wrote: > I traced the bug to the function cjkFragSplit in module paragraph.py. > > Attached is my attempted patch, which seems to work. Please review. I'll try and take a look at this over the weekend, am very busy right now. -- Robin Becker From hongyuan1306 at gmail.com Thu May 21 03:02:38 2009 From: hongyuan1306 at gmail.com (Yuan HOng) Date: Thu, 21 May 2009 15:02:38 +0800 Subject: [reportlab-users] cjk word wrapping does not work with
? In-Reply-To: <4A13C913.4030804@chamonix.reportlab.co.uk> References: <91320d220905190123t4d2f32d1xf06a6fbee078b3ca@mail.gmail.com> <91320d220905191857q139e24cbt2ee879e0a5b2138f@mail.gmail.com> <4A13C913.4030804@chamonix.reportlab.co.uk> Message-ID: <91320d220905210002k6c291b46x76c740a818ee878d@mail.gmail.com> On Wed, May 20, 2009 at 5:10 PM, Robin Becker wrote: > Yuan HOng wrote: > > I traced the bug to the function cjkFragSplit in module paragraph.py. > > > > Attached is my attempted patch, which seems to work. Please review. > I'll try and take a look at this over the weekend, am very busy right now. > For your info, my patch has one problem. All lines broken by
has a space as the first character and are thus slightly indented to the right than the first line. By the way, the following code snippet in cjkFragSplit has modified the loop variable 'i' as a last statement. This will however not have any effect upon the loop when using enumerate. So something might be wrong. for i, u in enumerate(U): w = u.width widthUsed += w lineBreak = hasattr(u.frag,'lineBreak') endLine = (widthUsed>maxWidth + _FUZZ and widthUsed>0) or lineBreak if endLine: if lineBreak: continue extraSpace = maxWidth - widthUsed + w #This is the most important of the Japanese typography rules. #if next character cannot start a line, wrap it up to this line so it hangs #in the right margin. We won't do two or more though - that's unlikely and #would result in growing ugliness. nextChar = U[i] if nextChar in ALL_CANNOT_START: extraSpace -= w i += 1 lines.append(makeCJKParaLine(U[lineStartPos:i],extraSpace,calcBounds)) try: maxWidth = maxWidths[len(lines)] except IndexError: maxWidth = maxWidths[-1] # use the last one lineStartPos = i widthUsed = w i -= 1 -- Hong Yuan ????????? ??????????? http://www.homemaster.cn -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.king at motorola.com Thu May 21 07:33:47 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Thu, 21 May 2009 12:33:47 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFD26@zuk35exm65.ds.mot.com> Hi, I've had a couple of reports from end users of my application that they are unable to print the PDFs that I generate using a patched version of ReportLab. The patch is the one that I sent to the list in November last year to support transparency in PDFs. I think it's quite likely that my patch is the cause of the errors, but I've no idea how to debug the problem. Here is an example error message that a user has sent me: %%[ ProductName: Distiller ]%% %%[Page: 1]%% %%[ Error: invalidrestore; OffendingCommand: restore ]%% Stack: -save- %%[ Flushing: rest of job (to end-of-file) will be ignored ]%% %%[ Warning: PostScript error. No PDF file produced. ] %% Unfortunately, I can't reproduce the error myself. Does anyone know of any tools for analysing PDF files that might help in tracking down the problem? Thanks a lot, Simon From marius at gedmin.as Thu May 21 07:39:36 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 21 May 2009 14:39:36 +0300 Subject: [reportlab-users] Release notes on the website In-Reply-To: <20090514172548.GB32438@platonas> References: <20090514144825.GA26101@platonas> <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> <20090514172548.GB32438@platonas> Message-ID: <20090521113936.GA32208@platonas> On Thu, May 14, 2009 at 08:25:48PM +0300, Marius Gedminas wrote: > On Thu, May 14, 2009 at 04:34:04PM +0100, Andy Robinson wrote: > > In any event, if upgrading I would recommend to go for the latest > > release version (2.3). > > Unfortunately 2.2 changes vertical positioning of paragraphs in a way > that breaks out reports. Compare: > > http://mg.pov.lt/reportlab/2.1/test-empty-pdr-0.png > http://mg.pov.lt/reportlab/2.2/test-empty-pdr-0.png > http://mg.pov.lt/reportlab/diff-2.1-vs-2.2/test-empty-pdr-0.png > > 2.3 produces the same output as 2.2. I haven't figured out yet whether > the bug is in our code, or in ReportLab. The text that remains in the > same position is drawn with > > canvas.drawString(x, y, "string") > > The large title text that is now shifted up is drawn with > > para = Paragraph("string", style) > para.wrap(PAGE_WIDTH - x * 2, PAGE_HEIGHT) > y -= para.height/2 > para.drawOn(canvas, x, y) > > The same vertical shift up happens everywhere Paragraphs are used, e.g. > tables containing Paragraphs inside table cells (also visible in that > image). It also happens to flowables added to the story, i.e. the first > paragraph on every page is shifted up: > > http://mg.pov.lt/reportlab/2.1/test-empty-pdr-1.png > http://mg.pov.lt/reportlab/2.2/test-empty-pdr-1.png > http://mg.pov.lt/reportlab/diff-2.1-vs-2.2/test-empty-pdr-1.png This is caused by the following change in Paragraph.drawPara between ReportLab 2.1 and 2.2: reportlab_2_1/reportlab/platypus/paragraph.py, line 993: cur_y = self.height - f.fontSize ReportLab_2_2/src/reportlab/platypus/paragraph.py, line 1276: cur_y = self.height - getattr(f,'ascent',f.fontSize) #TODO fix XPreformatted to remove this hack The font in question (Times New Roman) has fontSize=10 and ascent=6.83 (height=12) in one of our unit tests that I'm looking at now. The change was made in r3192 by rgbecker with "fix simple paragraph vertical position" as the commit message. I'm in a bit of a quandary now. Is it the font metrics that are incorrect, or is it the layout code? If you look at the table example again: http://mg.pov.lt/reportlab/2.2/test-empty-pdr-1.png the vertical positioning is clearly incorrect: the bottom padding inside the table cells should *not* be three times as large as the top padding. The code that draws it does the following (slightly paraphrased): normal_style = ParagraphStyle('normal') normal_style.firstLineIndent = 0 normal_style.spaceBefore = 6 normal_style.fontName = 'Times_New_Roman' normal_style.fontSize = 11.0 normal_style.alignment = TA_JUSTIFY cell_style = ParagraphStyle('cell_text', parent=normal_style) cell_style.alignment = TA_LEFT table_style = TableStyle([ ('GRID', (0, 0), (-1, -1), 0.25, colors.black), ]) rows = [[Paragraph(cgi.escape(value), cell_style) for value in row] for row in data_rows] table = Table(rows, style=table_style) flowables.append(table) So, is the bug (1) in the font metrics, (2) in Table layout code, or (3) in Paragraph drawing code, i.e. the change made in r3192? Marius Gedminas -- In order to get a loan you must first prove you don't need it. -------------- 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 Thu May 21 08:12:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 21 May 2009 13:12:25 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFD26@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E8617041AFD26@zuk35exm65.ds.mot.com> Message-ID: <956003ae0905210512j5776fa9bo651026fa245be731@mail.gmail.com> 2009/5/21 King Simon-NFHD78 : > > Unfortunately, I can't reproduce the error myself. Does anyone know of > any tools for analysing PDF files that might help in tracking down the > problem? I'm told that one should use Acrobat Professional, which has a "pre-flight tool". This is something Adobe bought from Callas Software which checks hundreds of things printers have been known to have problems with in the past. Sadly the PDF spec was a bit too loose in the early days ad there were 'many ways to do it' for printing, which means there isn't really a formal test of 'correctness for printing', and instead you get these firms doing pre-flighting tools who have been learning from experience. Most such tools are very expensive ($5000+), as it's a specialised area and still cheap compared to the average printing press, and the Acrobat one is the most affordable. Also, I hope, it could be deemed "official", and if it passes you could tell the printer it was their problem ;-) We will be getting a copy soon, but don't have it yet as we could test all we needed with the Standard version to date. If you have an offending PDF you can send in, we'll certainly keep it on file and check it. We are developing other print-related features in the next couple of months. 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 Thu May 21 08:30:16 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 21 May 2009 13:30:16 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFD26@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E8617041AFD26@zuk35exm65.ds.mot.com> Message-ID: <4A154958.1020608@chamonix.reportlab.co.uk> King Simon-NFHD78 wrote: > Hi, > ......... > > %%[ ProductName: Distiller ]%% > %%[Page: 1]%% > %%[ Error: invalidrestore; OffendingCommand: restore ]%% > > Stack: > -save- > > > %%[ Flushing: rest of job (to end-of-file) will be ignored ]%% > %%[ Warning: PostScript error. No PDF file produced. ] %% > ....... the tool that we use most often to fix problems is distiller. If distiller is failing then there's something seriously amiss with the document. However, looking at the error message it seems as though you have an extra restore which is unexpected. If you can get a cutdown example of a script that creates the problem then printing where the canvas restoreState method is called might help. I've been looking at the area of coluor spaces etc etc and I agree that the extended graphics state setting is a mess. At present I am undecided as to whether a separate state should be defined for each used parameter or not. I hope to look more closely at the transparency patch in the near future. -- Robin Becker From robin at reportlab.com Thu May 21 08:35:15 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 21 May 2009 13:35:15 +0100 Subject: [reportlab-users] Release notes on the website In-Reply-To: <20090521113936.GA32208@platonas> References: <20090514144825.GA26101@platonas> <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> <20090514172548.GB32438@platonas> <20090521113936.GA32208@platonas> Message-ID: <4A154A83.1050603@chamonix.reportlab.co.uk> Marius Gedminas wrote: ......... > > So, is the bug > > (1) in the font metrics, > > (2) in Table layout code, > > or > > (3) in Paragraph drawing code, i.e. the change made in r3192? > > Marius Gedminas It's impossible to say. Because we introduced images in paragraphs and needed to allow for height adjustments I needed to be more exact about the height above (and below) baseline. Originally we used Andy's approximation which was leading = 1.2*fontSize; where leading is the total distance between consecutive lines(not the size of the lead spacer as in traditional print speak). There was an implicit assumption that leading=ascent+descent and that ascent=fontSize. Clearly the 10pt Times New Roman doesn't come close to that. In the paragraph case we used to work out the height (in lines*leading) and then start the first baseline at top-ascent (ie top - fontSize). If we change our notion of ascent then the first baseline will move. Unfortunately nothing prevents people from separately specifying the leading as 12pt so paragraphs appear to shift upwards. On the other hand our table formatting code assumes either flowables(about which it knows nothing) or simple strings which I believe it assumes obey the original leading rule. If the leading rule is wrong then it's wrong in tables as well so probably we ought to fix it there. That still won't satisfy people who think vertical centred cells should have equal space above and below the text (unless ascent==descent). -- Robin Becker From andy at reportlab.com Thu May 21 12:23:53 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 21 May 2009 17:23:53 +0100 Subject: [reportlab-users] Ascent, descent and tables Message-ID: <956003ae0905210923i1b0110b5v5edd8af4a93fa2b7@mail.gmail.com> Marius, thanks for bringing this up, and producing examples. At various points in the last 2 years I have briefly half-understood this issue, then forgotten it again. We made necessary "improvements" to paragraphs to support inline images and equations for Wikipedia and to adjust inter-line heights within paragraphs, but it seems that in the process we are now reporting a bounding box for the paragraph that extends too far down. I amended test_platypus_tables.py which now produces the attached PDF. I also added a pink background so you can see the boundary reported by the paragraph. The paragraph claims to be using a chunk of space beneath the lowest descender. (BTW, before the change, the paragraphs used to claim to be using extra space ABOVE the highest extender, because of the approximation Robin refers to). We will try to change things so that (a) paragraphs report their bounding box as precisely as possible, and tables can then center this box vertically; and (b) paragraphs try to position naked text the same way they would position a one-line paragraph with the same font size and "leading". This might take a few days, and we will also need to look at preformatted blocks and labels in charts. If anyone knows of other problems not covered by this test case, please let me know... - Andy -------------- next part -------------- A non-text attachment was scrubbed... Name: test_platypus_tables.pdf Type: application/pdf Size: 5979 bytes Desc: not available Url : From ralsina at netmanagers.com.ar Thu May 21 12:26:37 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Thu, 21 May 2009 13:26:37 -0300 Subject: [reportlab-users] Automatic testing PDF output Message-ID: <200905211326.37323.ralsina@netmanagers.com.ar> I now a solution to this problem was posted a few months ago, but I really can't find it in the archives. So, I spend a few hours trying to reinvent the wheel, and here it is for google's sake: compare PDF testing tests reportlab automatically. It will check the metadata using pdfinfo (from poppler), and then visually page by page using imagemagick. If there are differences, you will have a diffpage-n.png where the differences are visible in red. If you want to compare two PDF files ($bn.pdf and correct/$bn.pdf), and have imagemagick and poppler installed and a bourne style shell: compare_pdfinfo() { # Given two PDF files $1 and $2, compare the output of pdfinfo except for # creation date. pdfinfo "$1" | grep -v CreationDate | grep -v "File size"> "$1.info" pdfinfo "$2" | grep -v CreationDate | grep -v "File size"> "$2.info" if cmp -s "$1.info" "$2.info" then true #echo "PDF metadata is correct" else echo "PDF metadata for $1 is wrong" fi rm "$1.info" "$2.info" } compare_pdfinfo $bn.pdf correct/$bn.pdf if [ ! -d temp-$bn ] then mkdir temp-$bn fi rm -f temp-$bn/* convert $bn.pdf temp-$bn/page.png convert correct/$bn.pdf temp-$bn/correctpage.png cd temp-$bn for page in page*png do result=`compare -metric PSNR $page correct$page diff$page 2>&1` if [ "$result" = "inf" ] then #echo "$page is OK" true else echo "$page has ERRORs, see temp-$bn/diff$page" fi done cd .. The latest version of the script where this fragment comes from will always be at http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/tests/input/run_tests.sh -- ("\''/").__..-''"`-. . 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 marius at gedmin.as Thu May 21 13:21:18 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 21 May 2009 20:21:18 +0300 Subject: [reportlab-users] Release notes on the website In-Reply-To: <4A154A83.1050603@chamonix.reportlab.co.uk> References: <20090514144825.GA26101@platonas> <956003ae0905140834o1aa0edb1paf4f6653529c7bb6@mail.gmail.com> <20090514172548.GB32438@platonas> <20090521113936.GA32208@platonas> <4A154A83.1050603@chamonix.reportlab.co.uk> Message-ID: <20090521172118.GA4688@platonas> On Thu, May 21, 2009 at 01:35:15PM +0100, Robin Becker wrote: > Marius Gedminas wrote: >> So, is the bug >> >> (1) in the font metrics, >> >> (2) in Table layout code, >> >> or >> >> (3) in Paragraph drawing code, i.e. the change made in r3192? > > It's impossible to say. Because we introduced images in paragraphs and > needed to allow for height adjustments I needed to be more exact about > the height above (and below) baseline. Isn't that orthogonal? There are two important positions here: * the position of the baseline relative to the area allocated to the paragraph * the position of the image relative to the baseline I don't see why was it necessary to shift the baseline. Could you elaborate? I tried to produce an example with an in-line tag in the paragraph. The output does not look right to me: http://mg.pov.lt/reportlab/test-2.3.pdf > Originally we used Andy's > approximation which was > leading = 1.2*fontSize; where leading is the total distance between > consecutive lines(not the size of the lead spacer as in traditional print > speak). There was an implicit assumption that leading=ascent+descent and > that ascent=fontSize. Is the goal here to produce output where the ascenders of the characters touch the top of the area allocated for the paragraph? Or is the goal to have the descenders of the characters touch the bottom of the area? This is the most important question in my email, I think. ReportLab 2.3 achieves goal (1). ReportLab 2.1, perhaps accidentally, used to achieve goal (2): http://mg.pov.lt/reportlab/test-2.1.pdf http://mg.pov.lt/reportlab/test-2.3.pdf The files were produced by http://mg.pov.lt/reportlab/paratest.py. Hm, if leading = ascent + descent, then both goals are the same, aren't they? Other than that, I don't quite see how that assumption is relevant. Actually, the ascent of the font defines the typical height of capital letters; accented letters will rise above the ascent (as you can see in the test-2.3.pdf). Is that really desirable? > Clearly the 10pt Times New Roman doesn't come close > to that. In the paragraph case we used to work out the height (in > lines*leading) and then start the first baseline at top-ascent (ie top - > fontSize). If we change our notion of ascent then the first baseline will > move. Hm, yes, I see that. > Unfortunately nothing prevents people from separately specifying > the leading as 12pt so paragraphs appear to shift upwards. That should be irrelevant, no? Even if you don't specify the leading explicitly the paragraphs will appear to shift upwards, as long as ascent != fontSize. > On the other hand our table formatting code assumes either > flowables(about which it knows nothing) or simple strings which I believe > it assumes obey the original leading rule. If the leading rule is wrong > then it's wrong in tables as well so probably we ought to fix it there. Perhaps. I think that Table([['simple string']], style=...) and Table([[Paragraph('simple string', style=...)]]) ought to produce the same output, assuming the paragraph and table styles specify the same font face and size, and that the table width is fixed. Would you agree with that? Currently the first one looks well, and the second version looks bad in ReportLab 2.3. > That still won't satisfy people who think vertical centred cells should > have equal space above and below the text (unless ascent==descent). So far I hadn't even considered vertically centered cells. Yay complications :-) So far I'm leaning towards the position that ReportLab should not have changed the position of the baselines within paragraphs in a backwards-incompatible manner. Would you accept a patch to shift the baselines to the old positioning, relative to the paragraph area? Are there any use cases where that would result in incorrect rendering? Marius Gedminas -- Q: How many IBM CPU's does it take to execute a job? A: Four; three to hold it down, and one to rip its head off. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From marius at gedmin.as Thu May 21 14:26:51 2009 From: marius at gedmin.as (Marius Gedminas) Date: Thu, 21 May 2009 21:26:51 +0300 Subject: [reportlab-users] Ascent, descent and tables In-Reply-To: <956003ae0905210923i1b0110b5v5edd8af4a93fa2b7@mail.gmail.com> References: <956003ae0905210923i1b0110b5v5edd8af4a93fa2b7@mail.gmail.com> Message-ID: <20090521182651.GA16335@platonas> On Thu, May 21, 2009 at 05:23:53PM +0100, Andy Robinson wrote: > Marius, thanks for bringing this up, and producing examples. At > various points in the last 2 years I have briefly half-understood this > issue, then forgotten it again. We made necessary "improvements" to > paragraphs to support inline images and equations for Wikipedia and to > adjust inter-line heights within paragraphs, That sounds *awesome*! > but it seems that in the > process we are now reporting a bounding box for the paragraph that > extends too far down. Do you still use leading_as_specified_in_style_* number_of_lines for the bounding box? I'm staring at the code here, and wondering about the autoLeading setting. Shouldn't (l.ascent - l.descent) be more or less equivalent to fontSize rather than leading? I'm not a typography expert, but e.g. Type is typically measured in points, and type size is referred to as point size. (Point size is determined by measuring from the top of the highest ascender to the bottom of the lowest descender, and therefore cannot be accurately measured from a single character.) -- http://ilovetypography.com/2008/04/25/extreme-type-terminology-part-4/ On the other hand I've also seen explanations saying that the font size nowadays is an arbitrary number, not necessarily related to the font's physical features. Nevertheless, for the built-in Times-Roman at 10pt I if I calcualte ascent-descent I get 9pt, while for Times New Roman the difference is 9.1pt. Leading shouldn't be smaller than the font size, should it? By the way, http://ilovetypography.com/2008/04/11/extreme-type-terminology-part-3/ has a very nice diagram about ascenders/descenders/etc. Before I read that post I had no idea there was a difference between ascent and ascender line (one is the cap height, the other is the ascender height, and they may be different). Also note that when you get accented capital letters such as ?????, the diacritics will be above the ascender line. > I amended test_platypus_tables.py which now produces the attached PDF. > I also added a pink background so you can see the boundary reported > by the paragraph. The paragraph claims to be using a chunk of space > beneath the lowest descender. Yes. > (BTW, before the change, the paragraphs used to claim to be using > extra space ABOVE the highest extender, because of the approximation > Robin refers to). Which is correct if you have diacritics, isn't it? I'm very aware of diacritics above capital letters since Lithuanian has them. ;-) > We will try to change things so that (a) paragraphs report their > bounding box as precisely as possible, and tables can then center this > box vertically; and (b) paragraphs try to position naked text the same > way they would position a one-line paragraph with the same font size > and "leading". This might take a few days, and we will also need to > look at preformatted blocks and labels in charts. Thank you! Though I have some reservations about that, see below. > If anyone knows of other problems not covered by this test case, > please let me know... To look good, the spacing between the top of the table cell and the ascender line should be the same or smaller than the spacing between the bottom of the table cell and the *baseline*. If you compute the bounds accurately, you'll have the top spacing match the spacing between the bottom of the table cell and the descender line, which will not look good. Because of this (and, to some lower extent, because of diacritics that may appear above the ascender line), I think it is correct for Paragraphs to claim a little extra space above the ascender line. I see two reasonable options for that extra space: * Claim abs(descent), i.e. the same amount as descenders currently do. This will give you perfect vertical centering inside table cells. * Claim (fontSize - ascent), which will position the baseline precisely fontSize points below the top of the area. This will restore backwards-compatibility with ReportLab versions prior to 2.2. Marius Gedminas -- (??_??) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From simon.king at motorola.com Fri May 22 05:31:07 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 10:31:07 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <956003ae0905210512j5776fa9bo651026fa245be731@mail.gmail.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFE52@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Andy Robinson > Sent: 21 May 2009 13:12 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > 2009/5/21 King Simon-NFHD78 : > > > > Unfortunately, I can't reproduce the error myself. Does > anyone know of > > any tools for analysing PDF files that might help in > tracking down the > > problem? > > I'm told that one should use Acrobat Professional, which has a > "pre-flight tool". This is something Adobe bought from Callas > Software which checks hundreds of things printers have been known to > have problems with in the past. > Hi Andy, Thanks a lot for getting back to me. I generated two PDFs from our application, 1 using the patched version of Reportlab, and the other using an unpatched version (2.2), and asked the user who was having problems to try printing both. He reported that he was unable to print either of them, so that implies that the problem is probably not due to my patch, and is either in Reportlab itself, or in the way we use it. It turns out that we have an old version of Acrobat Professional (v6) in the office, so I ran the preflighting tool on the PDF generated using the unpatched version of Reportlab. It reported 3 problems: 1. Device process color used but no OutputIntent (253 matches on 2 pages) 2. Font not embedded (and text rendering mode not 3) (4 matches on 2 pages) 3. Metadata entry missing I don't know how serious any of these errors are. I can post both the problematic PDF and the preflight report if you like, or if a 269Kb attachment is not suitable for the list I can send it to you directly. Thanks again for your help, Simon From andy at reportlab.com Fri May 22 05:47:31 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 10:47:31 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFE52@zuk35exm65.ds.mot.com> References: <956003ae0905210512j5776fa9bo651026fa245be731@mail.gmail.com> <8D20BBB55F590E42AADF592A815E8617041AFE52@zuk35exm65.ds.mot.com> Message-ID: <956003ae0905220247v56625a1bib8f5a3390ea43107@mail.gmail.com> 2009/5/22 King Simon-NFHD78 : > It turns out that we have an old version of Acrobat Professional (v6) in > the office, so I ran the preflighting tool on the PDF generated using > the unpatched version of Reportlab. It reported 3 problems: > > 1. Device process color used but no OutputIntent (253 matches on 2 > pages) > 2. Font not embedded (and text rendering mode not 3) (4 matches on 2 > pages) > 3. Metadata entry missing As far as we are concerned, we are 100% compliant with the spec and all these things are "optional", but the the print shop might want them. 1. OutputIntent came in with PDF 1.4, and we're 'officially' delivering PDF 1.3. So we're not in error, but there are whole chapters of newer PDF spec which I guess the print world would like us to implement. 2. Embedding fonts is a good idea but it's within your control. If you're using Helvetica, Courier or Times-Roman you are counting on the display device having those fonts; I can fully understand print shops wanting to always have the client's font embedded. So you need to change your app to include specific font files. 3. This is a PDF 1.4 optional feature which we don't yet support. However, none of them sound likely to cause the error with 'restore' or to cause printing to fail. The preflight tools is correctly warning of some differences between our files and what Quark/Illustrator/InDesign normally produce. We are discussing a possible job with a customer for delivery in June/July which might involve us producing much more print-ready PDFs, with a better colour model. If this goes ahead, some of these might get supported. > I don't know how serious any of these errors are. I can post both the > problematic PDF and the preflight report if you like, or if a 269Kb > attachment is not suitable for the list I can send it to you directly. Please send it directly to me; I'd be curious to see one. -- Andy From simon.king at motorola.com Fri May 22 06:35:24 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 11:35:24 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <956003ae0905220247v56625a1bib8f5a3390ea43107@mail.gmail.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFE6A@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Andy Robinson > Sent: 22 May 2009 10:48 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > However, none of them sound likely to cause the error with 'restore' > or to cause printing to fail. The preflight tools is correctly > warning of some differences between our files and what > Quark/Illustrator/InDesign normally produce. > I don't really understand why someone would be able to open a PDF file in Acrobat Reader (for example), and yet be unable to print it. I'm assuming that printers don't generally understand the PDF format directly, and that Acrobat converts it to Postscript before sending it to the printer driver. Is that too simplistic a view? Simon From andy at reportlab.com Fri May 22 06:48:58 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 11:48:58 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFE6A@zuk35exm65.ds.mot.com> References: <956003ae0905220247v56625a1bib8f5a3390ea43107@mail.gmail.com> <8D20BBB55F590E42AADF592A815E8617041AFE6A@zuk35exm65.ds.mot.com> Message-ID: <956003ae0905220348w1174feafi9956d222291066a1@mail.gmail.com> 2009/5/22 King Simon-NFHD78 : > I don't really understand why someone would be able to open a PDF file > in Acrobat Reader (for example), and yet be unable to print it. I'm > assuming that printers don't generally understand the PDF format > directly, and that Acrobat converts it to Postscript before sending it > to the printer driver. Is that too simplistic a view? It's exactly right. Acrobat Reader was deliberately forgiving in the early days and could recover from small errors in the graphics codes; everybody wishes they hadn't been, though i suppose it's better than the history of web browsers ;-) If you're using a typical Windows PC or some printing technology which rasterises on the computer like Mac's preview, and/or a typical inkjet or a cheap laser, the viewer sends an image to the printer. But if you're using a Postscript printer, it exports postscript. In this case a small bug like a missing graphics state operator in PDF can transfer the same bug to Postscript; and Postscript interpreters can then choke. The test for this is to export a Postscript file from Acrobat Reader; then run that through Distiller, and see the offending commands. In my experience the error messages are pretty much the same as the ones that come out of a good printer on the error page. - Andy From simon.king at motorola.com Fri May 22 07:24:28 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 12:24:28 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <956003ae0905220348w1174feafi9956d222291066a1@mail.gmail.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFE90@zuk35exm65.ds.mot.com> Andy Robinson wrote > 2009/5/22 King Simon-NFHD78 : > > I don't really understand why someone would be able to open > a PDF file > > in Acrobat Reader (for example), and yet be unable to print it. I'm > > assuming that printers don't generally understand the PDF format > > directly, and that Acrobat converts it to Postscript before > sending it > > to the printer driver. Is that too simplistic a view? > > It's exactly right. > > Acrobat Reader was deliberately forgiving in the early days and could > recover from small errors in the graphics codes; everybody wishes they > hadn't been, though i suppose it's better than the history of web > browsers ;-) > > If you're using a typical Windows PC or some printing technology which > rasterises on the computer like Mac's preview, and/or a typical inkjet > or a cheap laser, the viewer sends an image to the printer. But if > you're using a Postscript printer, it exports postscript. In this > case a small bug like a missing graphics state operator in PDF can > transfer the same bug to Postscript; and Postscript interpreters can > then choke. > > The test for this is to export a Postscript file from Acrobat Reader; > then run that through Distiller, and see the offending commands. In > my experience the error messages are pretty much the same as the ones > that come out of a good printer on the error page. > > - Andy Ah ha - the plot thickens. I had assumed that the printer I've been using was a Postscript printer, but actually it is a PCL one. I don't have access to a postscript printer, but we do have a linux server with a "virtual" Postscript printer with a shell script that uses ps2pdf to create PDFs. I tried printing to that printer, and the PDFs that came out were mostly blank, apart from the following error message: ERROR: invalidrestore OFFENDING COMMAND: restore STACK: -savelevel- -savelevel- I can't see an option to Save a Postscript file directly from Acrobat Reader except by using the "Print to file" option. If I do that, Acrobat says "The document could not be printed", but it still creates a postscript file. If I try to feed that postscript file through ps2pdf, I get the same error: %%[ ProductName: GNU Ghostscript ]%% %%[Page: 1]%% %%[ Error: invalidrestore; OffendingCommand: restore ]%% GNU Ghostscript 7.05: Unrecoverable error, exit code 1 So it really does look like there is something wrong with the postscript commands inside my PDF. Now that I can reproduce the problem, I'll start eliminating parts of the report to see if I can figure out exactly which part triggers the problem. I'll let you know what I find out. Thanks for all your help, Simon From andy at reportlab.com Fri May 22 08:02:15 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 13:02:15 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFE90@zuk35exm65.ds.mot.com> References: <956003ae0905220348w1174feafi9956d222291066a1@mail.gmail.com> <8D20BBB55F590E42AADF592A815E8617041AFE90@zuk35exm65.ds.mot.com> Message-ID: <956003ae0905220502n1fb6b86cu4af2df967a0fbe1@mail.gmail.com> 2009/5/22 King Simon-NFHD78 : > I can't see an option to Save a Postscript file directly from Acrobat > Reader except by using the "Print to file" option. On Linux, try "acroread --help". On Windows they don't offer that feature - it might encourage people to automate stuff ;-) > So it really does look like there is something wrong with the postscript > commands inside my PDF. Now that I can reproduce the problem, I'll start > eliminating parts of the report to see if I can figure out exactly which > part triggers the problem. Do you have the PDF specification to hand? The two commands to save and restore state are 'q' and 'Q' , and they should always come in matched, properly nested pairs as if they were '(' and ')' in a programming language. Maybe you could teach an editor to highlight and fold them ;-) - Andy From simon.king at motorola.com Fri May 22 08:22:22 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 13:22:22 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <956003ae0905220502n1fb6b86cu4af2df967a0fbe1@mail.gmail.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFEAA@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Andy Robinson > Sent: 22 May 2009 13:02 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > 2009/5/22 King Simon-NFHD78 : > > I can't see an option to Save a Postscript file directly > from Acrobat > > Reader except by using the "Print to file" option. > > On Linux, try "acroread --help". On Windows they don't offer that > feature - it might encourage people to automate stuff ;-) > > > So it really does look like there is something wrong with > the postscript > > commands inside my PDF. Now that I can reproduce the > problem, I'll start > > eliminating parts of the report to see if I can figure out > exactly which > > part triggers the problem. > > Do you have the PDF specification to hand? The two commands to save > and restore state are 'q' and 'Q' , and they should always come in > matched, properly nested pairs as if they were '(' and ')' in a > programming language. Maybe you could teach an editor to highlight > and fold them ;-) > > - Andy Yeah - I tried looking for those, but the files contain (what look like) encoded streams, and I wasn't sure whether the 'q' characters were actually commands or encoded data in those. I think I've got closer anyway - I stripped out everything except the document headers and footers and the disclaimer, and the problem still occurred. Then I changed one of the fonts from "Arial Unicode MS" to "Times-Roman", and the problem went away. So now it looks like the problem is related to the embedding of that font. Hopefully with that knowledge I can make a standalone test script that demonstrates the problem. As an aside - how do people generally deal with this problem: Our application generates reports which can contain arbitrary user-defined strings. How do we go about selecting a font for use in the report? We provide a user interface so that the user can select their own font, but we'd also like to select a reasonable default whenever possible. We chose Arial Unicode MS as the default (when we detect that it is installed), since it seems to be able to display most Unicode characters. I'd be interested to know if anyone has any better solutions? Cheers, Simon From ralsina at netmanagers.com.ar Fri May 22 08:48:43 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 22 May 2009 09:48:43 -0300 Subject: [reportlab-users] PDFs generated by ReportLab not printing References: <8D20BBB55F590E42AADF592A815E8617041AFEAA@zuk35exm65.ds.mot.com> Message-ID: King Simon-NFHD78 writes: > As an aside - how do people generally deal with this problem: Our > application generates reports which can contain arbitrary user-defined > strings. How do we go about selecting a font for use in the report? We > provide a user interface so that the user can select their own font, but > we'd also like to select a reasonable default whenever possible. We > chose Arial Unicode MS as the default (when we detect that it is > installed), since it seems to be able to display most Unicode > characters. I'd be interested to know if anyone has any better > solutions? You could ship DejaVu Sans. Not full unicode coverage (no thai, for example) but pretty good, and free, and you are allowed to embed it. From simon.king at motorola.com Fri May 22 08:57:41 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 13:57:41 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFEBD@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Roberto Alsina > Sent: 22 May 2009 13:49 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > King Simon-NFHD78 writes: > > > As an aside - how do people generally deal with this problem: Our > > application generates reports which can contain arbitrary > user-defined > > strings. How do we go about selecting a font for use in the > report? We > > provide a user interface so that the user can select their > own font, but > > we'd also like to select a reasonable default whenever possible. We > > chose Arial Unicode MS as the default (when we detect that it is > > installed), since it seems to be able to display most Unicode > > characters. I'd be interested to know if anyone has any better > > solutions? > > You could ship DejaVu Sans. Not full unicode coverage (no > thai, for example) > but pretty good, and free, and you are allowed to embed it. > That looks interesting. The Sans-only package is only 367k as well, which doesn't seem too much to add to an installer. I don't know how I missed the DejaVu fonts when I was researching this before. Thanks for the suggestion, Simon From gherman at darwin.in-berlin.de Fri May 22 09:41:26 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 22 May 2009 15:41:26 +0200 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <200905211326.37323.ralsina@netmanagers.com.ar> References: <200905211326.37323.ralsina@netmanagers.com.ar> Message-ID: <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> Roberto Alsina: > The latest version of the script where this fragment comes from will > always be > at > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/tests/input/run_tests.sh Roberto, that's great! Welcome to the club of people writing that kind of stuff! If you search long enough you'll find simi- lar things by others, and z3c.rml should also have that built in. I wrote my own tool maybe five years ago and I know of somebody else who did it six months ago. But that's hardly the problem. The problem is acknowledging the value of such tests and actually *using* them before making re- leases. Then and only then we might be able to prevent such, uhm, "interesting effects" like with the font baseline that we suffer from now. I'm actually very curious how much "fun" the z3c folks are hav- ing with these? So far at least I haven't seen Stefan Richter complaining yet. Perhaps we can solve them with a Google "Sum- mer of Code" in typography for ReportLab? In the meantime I'd be happy to see some workaround solutions proposed by ReportLab to make sure code up to RL 2.3 produces the same output as for RL 2.3. Regards, Dinu -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.king at motorola.com Fri May 22 09:55:20 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 14:55:20 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFEAA@zuk35exm65.ds.mot.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFED0@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > King Simon-NFHD78 > Sent: 22 May 2009 13:22 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > I think I've got closer anyway - I stripped out everything except the > document headers and footers and the disclaimer, and the problem still > occurred. Then I changed one of the fonts from "Arial Unicode MS" to > "Times-Roman", and the problem went away. So now it looks like the > problem is related to the embedding of that font. > > Hopefully with that knowledge I can make a standalone test script that > demonstrates the problem. > OK - the following script generates a PDF file that (for me at least) does not print on my Postscript printer: from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont pdfmetrics.registerFont(TTFont('Arial Unicode MS', 'ARIALUNI.ttf')) c = canvas.Canvas('arialtest.pdf') c.setFont('Arial Unicode MS', 32) c.drawString(10, 150, u"Some text in Arial Unicode MS") c.showPage() c.save() I'm still not completely sure what the problem is. If I try to convert the PDF file to PostScript using acroread -toPostScript on Linux, nothing gets generated and there is no error message. If I use Acrobat Reader on Windows and Print to file, it displays an error message ("The document could not be printed", sometimes followed by "A drawing error occurred"), but it does generate a postscript file. If I then try to convert that postscript file to PDF using ps2pdf, I get the following error message: %%[ ProductName: GNU Ghostscript ]%% %%[Page: 1]%% %%[ Error: invalidrestore; OffendingCommand: restore ]%% GNU Ghostscript 7.05: Unrecoverable error, exit code 1 However, I have a feeling that the postscript file that I am processing at that point is not really my original document, but a different document displaying the original error message. If I look at the Postscript file, it contains the following lines: userdict begin/PrtVMMsg{vmstatus exch sub exch pop gt{[^M (This job requires more memory than is available in this printer.)100 500^M (Try one or more of the following, and then print again:)100 485^M (For the output format, choose Optimize For Portability.)115 470^M (In the Device Settings page, make sure the Available PostScript Memory is accurate.)^M 115 455(Reduce the number of fonts in the document.)115 440^M (Print the document in parts.)115 425 12/Times-Roman showpage^M (%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def end^M version cvi 2016 ge{/VM?{pop}bind def}{/VM? userdict/PrtVMMsg get def}ifelse^M 105000 VM?^M Not knowing anything about Postscript, I'm not sure whether those are generic error messages, or whether they are actually an accurate description of the problem with the PDF file. I also don't know whether the problems are related to the printer driver itself (I'm using an HP Colour LaserJet 8500 PS, printing to a samba print queue). I'm not sure where I should be looking next to get this to work. Any suggestions would be much appreciated. Thanks again, Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: arialtest.pdf Type: application/octet-stream Size: 50066 bytes Desc: arialtest.pdf Url : From ralsina at netmanagers.com.ar Fri May 22 10:18:24 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 22 May 2009 11:18:24 -0300 Subject: [reportlab-users] Automatic testing PDF output References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> Message-ID: Dinu Gherman writes: > ? HTML content follows ? > > > Roberto Alsina: >> The latest version of the script where this fragment comes from will >> always be? >> at? >> > nput/run_tests.sh>http://code.google.com/p/rst2pdf/source/browse/trunk/rs >> t2pdf/tests/input/run_tests.sh > > > Roberto, that's great! Welcome to the club of people writing? > that?kind of stuff! If you?search long enough you'll find simi- > lar things?by?others, and z3c.rml should also have that built? > in. I wrote my own tool maybe five years ago and I know of? > somebody?else?who did it six months ago. Me too, I just can't find the code. Got any URLs? I much prefer to use Someone Else's Code (TM) > But that's hardly the problem.?The problem is acknowledging the? > value?of such tests and actually *using* them before making re- > leases. Then and only then we might be able to prevent such,? > uhm, "interesting effects" like with the font baseline?that we? > suffer from now.? Yup. rst2pdf is aiming in that direction. BTW: using svglib now instead of uniconv for SVG, great work! From simon.king at motorola.com Fri May 22 10:15:27 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 15:15:27 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFED0@zuk35exm65.ds.mot.com> Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFED7@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > King Simon-NFHD78 > Sent: 22 May 2009 14:55 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > OK - the following script generates a PDF file that (for me at least) > does not print on my Postscript printer: > > > from reportlab.pdfgen import canvas > from reportlab.pdfbase import pdfmetrics > from reportlab.pdfbase.ttfonts import TTFont > pdfmetrics.registerFont(TTFont('Arial Unicode MS', 'ARIALUNI.ttf')) > > c = canvas.Canvas('arialtest.pdf') > c.setFont('Arial Unicode MS', 32) > c.drawString(10, 150, u"Some text in Arial Unicode MS") > c.showPage() > c.save() > > > I'm still not completely sure what the problem is. If I try to convert > the PDF file to PostScript using acroread -toPostScript on Linux, > nothing gets generated and there is no error message. If I use Acrobat > Reader on Windows and Print to file, it displays an error > message ("The > document could not be printed", sometimes followed by "A drawing error > occurred") In case anyone is still following this thread, the error sounds suspiciously similar to the one described at http://pdfsharp.s3.bizhat.com/pdfsharp-ftopic339.html, which suggests that for Unicode fonts, you have to set the font encoding to Unicode. I'll see if I can figure out how to do that. From srichter at cosmos.phy.tufts.edu Fri May 22 10:18:14 2009 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Fri, 22 May 2009 07:18:14 -0700 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> Message-ID: <200905221018.15010.srichter@cosmos.phy.tufts.edu> On Friday 22 May 2009, Dinu Gherman wrote: > 'm actually very curious how much "fun" the z3c folks are hav- > ing with these? So far at least I haven't seen Stefan Richter > complaining yet. Perhaps we can solve them with a Google "Sum- > mer of Code" in typography for ReportLab? Honestly, I have not used z3c.rml for a long time, so I have not run the tests against the latest RL recently. I would certainly be in a world of pain changing the expected output PDF files. Especially since the point of the expected PDF files is to visually verify their correctness. That said, the PDF comparison test was invaluable while developing z3c.rml. I found several bugs because of them, comparing output between some of reportlabs RML examples and z3c.rml. Regards, Stephan -- Entrepreneur and Software Geek Google me. "Zope Stephan Richter" From andy at reportlab.com Fri May 22 10:31:36 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 15:31:36 +0100 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> Message-ID: <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> 2009/5/22 Dinu Gherman : > Perhaps we can solve them with a Google?"Sum- > mer of Code" in?typography for ReportLab? Just knowing that 'something changed' in the full test suite output of rst2pdf, z3c.rml or even our own test suite is of limited use. There are a ton of spurious changes at the pixel level when you update libraries involved in the rendering of the text as well as the generation (or switch fonts at someone else's behest!). We've tried. What we could really use is a collection of small scripts or functions, each exercising one carefully-thought-out "feature that matters", with a brief note underneath saying what the inspector should see. For example, the table I posted yesterday and the statement 'all cells in this table should have the same baseline'. We can then link these up on our servers to show a gallery of images, tied together with HTML, allowing easy visual inspection and also drawing the eye to differences between (say) trunk and last release. And when there is a change, a human can sort through fairly easily deciding if they matter. - Andy From gherman at darwin.in-berlin.de Fri May 22 10:53:54 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 22 May 2009 16:53:54 +0200 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> Message-ID: <901F7823-5652-4932-92ED-2FBC2B5565D9@darwin.in-berlin.de> Andy Robinson: > Just knowing that 'something changed' in the full test suite output of > rst2pdf, z3c.rml or even our own test suite is of limited use. There > are a ton of spurious changes at the pixel level when you update > libraries involved in the rendering of the text as well as the > generation (or switch fonts at someone else's behest!). We've tried. There is stuff you expect to change and there is stuff you expect *not* to change. Both can be tested, isn't it? People on this list have shown how to do it. > What we could really use is a collection of small scripts or > functions, each exercising one carefully-thought-out "feature that > matters", with a brief note underneath saying what the inspector > should see. For example, the table I posted yesterday and the > statement 'all cells in this table should have the same baseline'. That almost sounds like you're having a plan. So what's the next action? My suggestion is: ask yourself who should be responsible to implement it? Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From simon.king at motorola.com Fri May 22 11:18:15 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 22 May 2009 16:18:15 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing Message-ID: <8D20BBB55F590E42AADF592A815E8617041AFEE0@zuk35exm65.ds.mot.com> > -----Original Message----- > From: King Simon-NFHD78 > Sent: 22 May 2009 15:15 > To: 'Support list for users of Reportlab software' > Subject: RE: [reportlab-users] PDFs generated by ReportLab > not printing > > In case anyone is still following this thread, the error > sounds suspiciously similar to the one described at > http://pdfsharp.s3.bizhat.com/pdfsharp-ftopic339.html, which > suggests that for Unicode fonts, you have to set the font > encoding to Unicode. I'll see if I can figure out how to do that. I'm still confused. As far as I can tell, TrueType fonts contain their own encoding information, so there should be no need to specify an encoding. My simple PDF contains this: % Font Arial Unicode MS subset 0 << /BaseFont /AAAAAA+ArialUnicodeMS /FirstChar 0 /FontDescriptor 6 0 R /LastChar 127 /Name /F2+0 /Subtype /TrueType /ToUnicode 4 0 R /Type /Font /Widths [ 1000 1000 1000 ... Etc There is no /Encoding key in there, but I've no idea whether there should be. From andy at reportlab.com Fri May 22 11:54:19 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 16:54:19 +0100 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <901F7823-5652-4932-92ED-2FBC2B5565D9@darwin.in-berlin.de> References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> <901F7823-5652-4932-92ED-2FBC2B5565D9@darwin.in-berlin.de> Message-ID: <956003ae0905220854m1902de1aq88253f1cad81e84e@mail.gmail.com> > That almost sounds like you're having a plan. So what's the next > action? Wait for someone to send in some of those scripts. > My suggestion is: ask yourself who should be responsible > to implement it? OK. You suggested a 'summer of typography' - have you volunteered? ;-) I have simply suggested the kinds of "eyeball tests" which would be most likely to get adopted by us and rolled into our process. Tests which generate more false alarms than real issues will get ignored, unless the ergonomics are thought out. Personally, after we work out the best fix I intend to lock down the agreed behaviour with a handful of unit tests that assert certain things about heights of paragraphs and table cells. This should take no more than 15 minutes, catch things even faster and not break when fonts change. - Andy From srichter at cosmos.phy.tufts.edu Fri May 22 12:30:34 2009 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Fri, 22 May 2009 09:30:34 -0700 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> References: <200905211326.37323.ralsina@netmanagers.com.ar> <8A236B3C-0281-40AD-BE88-C32B04091B6D@darwin.in-berlin.de> <956003ae0905220731v49ea3302j89bd3fb441eaa0d8@mail.gmail.com> Message-ID: <200905221230.34848.srichter@cosmos.phy.tufts.edu> On Friday 22 May 2009, Andy Robinson wrote: > Just knowing that 'something changed' in the full test suite output of > rst2pdf, z3c.rml or even our own test suite is of limited use. ?There > are a ton of spurious changes at the pixel level when you update > libraries involved in the rendering of the text as well as the > generation (or switch fonts at someone else's behest!). ? We've tried. Me too and I am claiming it worked quiet well.The picture comparison worked on multiple OSes (including Wondows) over various OS upgrades in Linux. > What we could really use is a collection of small scripts or > functions, each exercising one carefully-thought-out "feature that > matters", with a brief note underneath saying what the inspector > should see. ? For example, the table I posted yesterday and the > statement 'all cells in this table should have the same baseline'. Well, in my case the RML documents that. Since I usually demonstrate a single feature, my expected output RML and PDF are pretty simple too. > We can then link these up on our servers to show a gallery of images, > tied together with HTML, allowing easy visual inspection and also > drawing the eye to differences between (say) trunk and last release. > And when there is a change, a human can sort through fairly easily > deciding if they matter. yep. I really liked Marius' diffing technique. I would love to integrate that in z3c.rml when a failure occurs. Regards, Stephan -- Entrepreneur and Software Geek Google me. "Zope Stephan Richter" From marius at gedmin.as Fri May 22 13:29:04 2009 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 22 May 2009 20:29:04 +0300 Subject: [reportlab-users] Automatic testing PDF output In-Reply-To: <200905211326.37323.ralsina@netmanagers.com.ar> References: <200905211326.37323.ralsina@netmanagers.com.ar> Message-ID: <20090522172904.GA31521@platonas> On Thu, May 21, 2009 at 01:26:37PM -0300, Roberto Alsina wrote: > I now a solution to this problem was posted a few months ago, but I really > can't find it in the archives. > > So, I spend a few hours trying to reinvent the wheel, and here it is for > google's sake: compare PDF testing tests reportlab automatically. > > It will check the metadata using pdfinfo (from poppler), and then visually > page by page using imagemagick. If there are differences, you will have a > diffpage-n.png where the differences are visible in red. The pdfinfo thing is a good idea, I hadn't thought of it. I'm also a proud member of the Wheel Inventors Club. I've an application (sadly, not open source) that produces PDF reports. It has three levels of tests: * unit tests test that various functions produce the right flowables with the right attributes, and also they test the rendering of custom flowables by using a mock Canvas object that records all drawing operations * functional tests produce PDFs, proxying the real Canvas and logging all drawing operations to a text file, at a relatively low level. The "drawing" operations include metadata such as bookmarks. (This was implemented by a coworker of mine, Justas Sadzevi?ius, so I'm not the only one Wheel Inventor here ;-) * there's a script that renders PDFs into PNG files and compares them with ImageMagick; it produces an HTML report with all the differences and links to the corresponding PDFs. Essentially the same as your solution. The first two are part of the automated test suite and are run from buildbot. The third one needs manual intervention; its purpose is to see whether the failures of the automated functional tests are important or not. (And to see how an upgrade to a newer ReportLab version changes the look of our tests. That was a Firefox-killer HTML page, let me tell you.) The text-log of PDF drawing operations has an advantage over bitmap comparison in that it's faster: 35 functional tests (producing around ~450 pages of output total) require about 35 seconds to run on a fast machine. It doesn't have the advantage I originally thought it would have; namely human-readability of the diffs. It does have the advantage of recording metadata (our third PDF-rendering script ignores it), but your solution with pdfinfo covers that. Marius Gedminas -- Place mark here ->[ ]<- if you want a dirty monitor. -------------- 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 May 22 18:30:16 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 22 May 2009 23:30:16 +0100 Subject: [reportlab-users] Ascent, descent and tables In-Reply-To: <956003ae0905210923i1b0110b5v5edd8af4a93fa2b7@mail.gmail.com> References: <956003ae0905210923i1b0110b5v5edd8af4a93fa2b7@mail.gmail.com> Message-ID: <956003ae0905221530v1b466bdcnfb61f8eab214625f@mail.gmail.com> 2009/5/21 Andy Robinson : > We will try to change things so that (a) paragraphs report their > bounding box as precisely as possible, and tables can then center this > box vertically; and (b) paragraphs try to position naked text the same > way they would position a one-line paragraph with the same font size > and "leading". I just committed a simple change and believe that the overall vertical shift is now back where it was. (i.e. I ran the new tables script against 2.1 and trunk, and can't find any differences). (b) works, but it turns out (a) was always wrong and still is. However, this may not be the end of it. I will need to talk to the folks at Wikipedia next week, who asked for these changes within paragraph code, and check if any of this matters to them. I am working on the theory that what they needed was internal to multiline paragraphs, and that an overall vertical shift was not part of the spec, so shifting it back won't bite them. I therefore left a big switch in the code so we developers can flip back and forth on this. The new test page backported to 2.1 shows that neither the old nor the new code accurately worked out the 'boundary of the paragraph', but that our old dumb algorithm looks as good to the eye as anything else. Marius, thanks very much for your help! -- Andy From marius at gedmin.as Fri May 22 20:49:46 2009 From: marius at gedmin.as (Marius Gedminas) Date: Sat, 23 May 2009 03:49:46 +0300 Subject: [reportlab-users] ReportLab downloads broken: 403 Forbidden Message-ID: <20090523004946.GA31247@platonas> http://www.reportlab.org/downloads.html#reportlab tells me I can download the latest source version from http://www.reportlab.org/ftp/ReportLab_2_3.tar.gz, but that URL gives me a 403 error: Forbidden You don't have permission to access /ftp/ReportLab_2_3.tar.gz on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. --- Apache/2.0.59 (FreeBSD) DAV/2 SVN/1.4.0 mod_fastcgi/2.4.2 mod_python/3.2.10 Python/2.4.3 mod_ssl/2.0.59 OpenSSL/0.9.7e-p1 Server at www.reportlab.org Port 80 Marius Gedminas -- If it weren't for the last minute, nothing would ever get done. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From johnkeyes at gmail.com Fri May 22 20:58:07 2009 From: johnkeyes at gmail.com (John Keyes) Date: Sat, 23 May 2009 01:58:07 +0100 Subject: [reportlab-users] Barcode Bug? Message-ID: <4A174A1F.5030402@gmail.com> Hi, This is my first post so please be gentle :) I think I've found a bug in the barcode code. The following code: barcode=code39.Standard39("xxx", barWidth=0.275*mm, barHeight=10*mm, ratio=2.3, humanReadable=True) barcode.drawOn(canvas, x, y) raise the following error: barcode.drawOn(canvas, x, y) File "site-packages/reportlab/platypus/flowables.py", line 105, in drawOn self._drawOn(canvas) File "site-packages/reportlab/platypus/flowables.py", line 89, in _drawOn self.draw()#this is the bit you overload File "site-packages/reportlab/graphics/barcode/common.py", line 146, in draw self.drawHumanReadable() File "site-packages/reportlab/graphics/barcode/common.py", line 164, in drawHumanReadable self.annotate(x+width/2.,-y,s,fontName,fontSize) File "site-packages/reportlab/graphics/barcode/common.py", line 176, in annotate getattr(canv,func)(text,x,y) File "site-packages/reportlab/pdfgen/canvas.py", line 1287, in drawCentredString width = self.stringWidth(text, self._fontname, self._fontsize) File "site-packages/reportlab/pdfgen/canvas.py", line 1392, in stringWidth (fontSize,self._fontsize)[fontSize is None]) File "site-packages/reportlab/pdfbase/pdfmetrics.py", line 718, in _py_stringWidth return getFont(fontName).stringWidth(text, fontSize, encoding=encoding) File "site-packages/reportlab/pdfbase/pdfmetrics.py", line 402, in _py_stringWidth if not isinstance(text,unicode): text = text.decode(encoding) AttributeError: 'float' object has no attribute 'decode' To prevent this error I changed line 176 in reportlab/graphics/barcode/common.py from: getattr(canv,func)(text,x,y) to: getattr(canv,func)(x,y,text) Do you need a patch and test etc. for this? Thanks, -John K From andy at reportlab.com Sat May 23 02:59:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Sat, 23 May 2009 07:59:25 +0100 Subject: [reportlab-users] ReportLab downloads broken: 403 Forbidden In-Reply-To: <20090523004946.GA31247@platonas> References: <20090523004946.GA31247@platonas> Message-ID: <956003ae0905222359j3824cbbcrf3fab82de7dcae7e@mail.gmail.com> 2009/5/23 Marius Gedminas : > http://www.reportlab.org/downloads.html#reportlab tells me I can > download the latest source version from > http://www.reportlab.org/ftp/ReportLab_2_3.tar.gz, but that URL gives me > a 403 error: Damn, download area is back now. Sorry everyone. Last month we set up two swappable website environments to make code promotions seamless; turns out one of them was missing a symlink. - Andy From robin at reportlab.com Sun May 24 07:07:46 2009 From: robin at reportlab.com (Robin Becker) Date: Sun, 24 May 2009 12:07:46 +0100 Subject: [reportlab-users] CJK
handling Message-ID: <4A192A82.30200@jessikat.plus.net> Can you try the attached version of the paragraph.py module to see if it behaves properly for your application. I have been through the original code and have tried to fix up the loop structure a bit. I tried a couple of experiments and it seems to break all right for me with the
and I don't get extra space. -- Robin Becker -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: paragraph.py Url: From arkadi at smartbit.be Tue May 26 04:14:00 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Tue, 26 May 2009 10:14:00 +0200 Subject: [reportlab-users] split table cell on next page Message-ID: <4A1BA4C8.80509@smartbit.be> Hi, I have a problem with a table with to columns and multiple rows. On the left side there is only one sentence but the right side can contain a big paragraph. Even that big that is doesn't fit on 1 page any more. So then I receive the following error building the pdf: reportlab.platypus.doctemplate.LayoutError: Flowable with cell(0,0) containing 'Aanpak (hoe?)' too large on page 14 Is there a solution for this to let reportlab render the pdf anyway? Thanks in advance, Arkadi Colson -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Tue May 26 04:37:28 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 26 May 2009 09:37:28 +0100 Subject: [reportlab-users] split table cell on next page In-Reply-To: <4A1BA4C8.80509@smartbit.be> References: <4A1BA4C8.80509@smartbit.be> Message-ID: <956003ae0905260137v3e45c3bbm5cf0f494b6af2f0@mail.gmail.com> 2009/5/26 Arkadi Colson : > Hi, > I have a problem with a table with to columns and multiple rows. On the left > side there is only one sentence but the right side can contain a big > paragraph. Even that big that is doesn't fit on 1 page any more. We cannot split within table cells. So, if you have a table cell too big to fit on a page, you're in trouble. If you know this is going to happen, you'll have to design your data or document differently. If it's something that can occur sometimes with exceptional values, and you want to know where without getting a traceback, is there any way you can preprocess the data and truncate exceptionally long values, or warn before formatting starts? - Andy From robin at reportlab.com Tue May 26 05:22:30 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 26 May 2009 10:22:30 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E8617041AFEE0@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E8617041AFEE0@zuk35exm65.ds.mot.com> Message-ID: <4A1BB4D6.6010900@chamonix.reportlab.co.uk> King Simon-NFHD78 wrote: >> -----Original Message----- >> From: King Simon-NFHD78 >> Sent: 22 May 2009 15:15 >> To: 'Support list for users of Reportlab software' >> Subject: RE: [reportlab-users] PDFs generated by ReportLab >> not printing >> >> In case anyone is still following this thread, the error >> sounds suspiciously similar to the one described at >> http://pdfsharp.s3.bizhat.com/pdfsharp-ftopic339.html, which >> suggests that for Unicode fonts, you have to set the font >> encoding to Unicode. I'll see if I can figure out how to do that. > > I'm still confused. As far as I can tell, TrueType fonts contain their > own encoding information, so there should be no need to specify an > encoding. > > My simple PDF contains this: > > % Font Arial Unicode MS subset 0 > << /BaseFont /AAAAAA+ArialUnicodeMS > /FirstChar 0 > /FontDescriptor 6 0 R > /LastChar 127 > /Name /F2+0 > /Subtype /TrueType > /ToUnicode 4 0 R > /Type /Font > /Widths [ 1000 > 1000 > 1000 > ... Etc > > There is no /Encoding key in there, but I've no idea whether there > should be. ......... as we currently handle TTF fonts we are creating subsets each with their own encoding vector. Text using the font uses this encoding vector instead of a more standard form. We also create and output the ToUnicode object ie a mapping from our subset to unicode. I believe that's to allow for translation of our encoded strings into unicode for searching etc etc. FWIW I think the default is to have the first 128 entries of our first subset be equivalent to ascii 0-127. That allows for readability of the text strings in a common case. -- Robin Becker From marius at gedmin.as Tue May 26 08:46:44 2009 From: marius at gedmin.as (Marius Gedminas) Date: Tue, 26 May 2009 15:46:44 +0300 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1BB4D6.6010900@chamonix.reportlab.co.uk> References: <8D20BBB55F590E42AADF592A815E8617041AFEE0@zuk35exm65.ds.mot.com> <4A1BB4D6.6010900@chamonix.reportlab.co.uk> Message-ID: <20090526124644.GB26998@platonas> On Tue, May 26, 2009 at 10:22:30AM +0100, Robin Becker wrote: > King Simon-NFHD78 wrote: >>> -----Original Message----- >>> From: King Simon-NFHD78 Sent: 22 May 2009 15:15 >>> To: 'Support list for users of Reportlab software' >>> Subject: RE: [reportlab-users] PDFs generated by ReportLab not >>> printing >>> >>> In case anyone is still following this thread, the error sounds >>> suspiciously similar to the one described at >>> http://pdfsharp.s3.bizhat.com/pdfsharp-ftopic339.html, which >>> suggests that for Unicode fonts, you have to set the font encoding to >>> Unicode. I'll see if I can figure out how to do that. >> >> I'm still confused. As far as I can tell, TrueType fonts contain their >> own encoding information, so there should be no need to specify an >> encoding. >> >> My simple PDF contains this: >> >> % Font Arial Unicode MS subset 0 >> << /BaseFont /AAAAAA+ArialUnicodeMS >> /FirstChar 0 >> /FontDescriptor 6 0 R >> /LastChar 127 >> /Name /F2+0 >> /Subtype /TrueType >> /ToUnicode 4 0 R >> /Type /Font >> /Widths [ 1000 1000 1000 >> ... Etc >> >> There is no /Encoding key in there, but I've no idea whether there >> should be. > ......... > > as we currently handle TTF fonts we are creating subsets each with their > own encoding vector. Text using the font uses this encoding vector > instead of a more standard form. We also create and output the ToUnicode > object ie a mapping from our subset to unicode. I believe that's to allow > for translation of our encoded strings into unicode for searching etc > etc. > > FWIW I think the default is to have the first 128 entries of our first > subset be equivalent to ascii 0-127. That allows for readability of the > text strings in a common case. Also, code 32 in a PDF font is always special and gets extra spacing. This is used to implement paragraph justification. Marius Gedminas -- To express oneself In seventeen syllables Is very diffic -- John Cooper Clark. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From ralsina at netmanagers.com.ar Tue May 26 20:57:28 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 26 May 2009 21:57:28 -0300 Subject: [reportlab-users] Image flowable and relative widths Message-ID: <200905262157.28937.ralsina@netmanagers.com.ar> Is there a way to make the Image flowable work as HTML's img tag with relative widths? Just like in HTML an IMG tag with a 80% width will take 80% of its container. I looked at the sources, but it seems a 80 width with a 'percentage' kind actually works like HTML's scale (that is, show it at 80% of the image's width). Could another 'kind' be added? It would imply calculating drawWidth and drawHeight at wrap() time, 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 andy at reportlab.com Wed May 27 03:22:53 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 27 May 2009 08:22:53 +0100 Subject: [reportlab-users] Image flowable and relative widths In-Reply-To: <200905262157.28937.ralsina@netmanagers.com.ar> References: <200905262157.28937.ralsina@netmanagers.com.ar> Message-ID: <956003ae0905270022w1cac8261u5ceba080619952f8@mail.gmail.com> 2009/5/27 Roberto Alsina : > Is there a way to make the Image flowable work as HTML's img tag with relative > widths? > > Just like in HTML an IMG tag with a 80% width will take 80% of its container. > > I looked at the sources, but it seems a 80 width with a 'percentage' kind > actually works like HTML's scale (that is, show it at 80% of the image's > width). > > Could another 'kind' be added? It would imply calculating drawWidth and > drawHeight at wrap() time, though. This makes a lot of sense; we could have used this on something yesterday! I have logged it in the tracker and hopefully we'll get it done in the next few days. - Andy From simon.king at motorola.com Wed May 27 05:41:47 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Wed, 27 May 2009 10:41:47 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing Message-ID: <8D20BBB55F590E42AADF592A815E86170420AC50@zuk35exm65.ds.mot.com> Robin Becker wrote: >......... > as we currently handle TTF fonts we are creating subsets each with their own > encoding vector. Text using the font uses this encoding vector instead of a more > standard form. We also create and output the ToUnicode object ie a mapping from > our subset to unicode. I believe that's to allow for translation of our encoded > strings into unicode for searching etc etc. > > FWIW I think the default is to have the first 128 entries of our first subset be > equivalent to ascii 0-127. That allows for readability of the text strings in a > common case. > -- > Robin Becker OK - thanks very much for letting me know. Does anyone else on the list use the font "Arial Unicode MS" in their PDFs, and if so, are they able to print those PDFs on a Postscript printer? Given that such a simple test case triggers the error, I'm surprised that I'm the only that's seeing the problem, which leads me to believe that I'm doing something silly. I would really appreciate it if someone could confirm that they at least see the same behaviour that I see. Thanks again, Simon From gherman at darwin.in-berlin.de Wed May 27 06:01:24 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 27 May 2009 12:01:24 +0200 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420AC50@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420AC50@zuk35exm65.ds.mot.com> Message-ID: <68085FB3-CA17-46D3-91EF-48825068E65B@darwin.in-berlin.de> King Simon-NFHD78: > Does anyone else on the list use the font "Arial Unicode MS" in their > PDFs, and if so, are they able to print those PDFs on a Postscript > printer? Given that such a simple test case triggers the error, I'm > surprised that I'm the only that's seeing the problem, which leads > me to > believe that I'm doing something silly. I would really appreciate it > if > someone could confirm that they at least see the same behaviour that I > see. Simon, I'm on a Mac (for more than one reason), but if you send me a sample PDF I'll be glad to test it on my HP LaserJet... Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed May 27 06:08:55 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 27 May 2009 11:08:55 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <68085FB3-CA17-46D3-91EF-48825068E65B@darwin.in-berlin.de> References: <8D20BBB55F590E42AADF592A815E86170420AC50@zuk35exm65.ds.mot.com> <68085FB3-CA17-46D3-91EF-48825068E65B@darwin.in-berlin.de> Message-ID: <4A1D1137.7030204@chamonix.reportlab.co.uk> Dinu Gherman wrote: > King Simon-NFHD78: > >> Does anyone else on the list use the font "Arial Unicode MS" in their >> PDFs, and if so, are they able to print those PDFs on a Postscript >> printer? Given that such a simple test case triggers the error, I'm >> surprised that I'm the only that's seeing the problem, which leads me to >> believe that I'm doing something silly. I would really appreciate it if >> someone could confirm that they at least see the same behaviour that I >> see. > > > Simon, > > I'm on a Mac (for more than one reason), but if you send me > a sample PDF I'll be glad to test it on my HP LaserJet... > > Regards, > > Dinu .......... I can answer already that printing on a laser jet works fine for arial and similar. -- Robin Becker From simon.king at motorola.com Wed May 27 06:13:02 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Wed, 27 May 2009 11:13:02 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <68085FB3-CA17-46D3-91EF-48825068E65B@darwin.in-berlin.de> Message-ID: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Dinu Gherman > Sent: 27 May 2009 11:01 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > King Simon-NFHD78: > > > Does anyone else on the list use the font "Arial > Unicode MS" in their > PDFs, and if so, are they able to print those PDFs on a > Postscript > printer? Given that such a simple test case triggers > the error, I'm > surprised that I'm the only that's seeing the problem, > which leads me to > believe that I'm doing something silly. I would really > appreciate it if > someone could confirm that they at least see the same > behaviour that I > see. > > > Simon, > > I'm on a Mac (for more than one reason), but if you send me > a sample PDF I'll be glad to test it on my HP LaserJet... > > > Regards, > > Dinu > Thanks Dinu. In fact I'd be very interested to know whether the same problem occurs on a Mac. The attachment at the bottom of the message at http://two.pairlist.net/pipermail/reportlab-users/2009-May/008302.html is a very small PDF using that font. The script that generated it is shown in the message. Robin Becker wrote: > I can answer already that printing on a laser jet works fine for arial and similar. Thanks Robin. Is that the standard 'arial', or 'Arial Unicode MS' (http://en.wikipedia.org/wiki/Arial_Unicode_MS)? Thanks, Simon From robin at reportlab.com Wed May 27 06:21:14 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 27 May 2009 11:21:14 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> Message-ID: <4A1D141A.8030302@chamonix.reportlab.co.uk> King Simon-NFHD78 wrote: ........ > > Thanks Robin. Is that the standard 'arial', or 'Arial Unicode MS' > (http://en.wikipedia.org/wiki/Arial_Unicode_MS)? > > Thanks, > > Simon ...... both, we use many windows fonts as ttfs and all seem to print OK on our laserjet 1010. I just printed your "Some text in Arial Unicode MS" example and that worked fine. -- Robin Becker From gherman at darwin.in-berlin.de Wed May 27 06:32:10 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 27 May 2009 12:32:10 +0200 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> Message-ID: <3B148888-2956-4725-BDF6-B47EB411C0A6@darwin.in-berlin.de> King Simon-NFHD78: > Thanks Dinu. In fact I'd be very interested to know whether the same > problem occurs on a Mac. > > The attachment at the bottom of the message at > http://two.pairlist.net/pipermail/reportlab-users/2009-May/008302.html > is a very small PDF using that font. The script that generated it is > shown in the message. That prints just fine! Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.king at motorola.com Wed May 27 07:35:08 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Wed, 27 May 2009 12:35:08 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1D141A.8030302@chamonix.reportlab.co.uk> Message-ID: <8D20BBB55F590E42AADF592A815E86170420ACD8@zuk35exm65.ds.mot.com> > -----Original Message----- > From: reportlab-users-bounces at reportlab.com > [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of > Robin Becker > Sent: 27 May 2009 11:21 > To: Support list for users of Reportlab software > Subject: Re: [reportlab-users] PDFs generated by ReportLab > not printing > > King Simon-NFHD78 wrote: > ........ > > > > Thanks Robin. Is that the standard 'arial', or 'Arial Unicode MS' > > (http://en.wikipedia.org/wiki/Arial_Unicode_MS)? > > > > Thanks, > > > > Simon > ...... > both, we use many windows fonts as ttfs and all seem to print > OK on our laserjet > 1010. I just printed your "Some text in Arial Unicode MS" > example and that > worked fine. > -- > Robin Becker Thanks a lot for testing that. It's beginning to sound like it might be an issue with the printer driver itself. Does that sound realistic? (I can reproduce the problem using the Windows driver for an HP Color LaserJet 8500 PS). I would love to understand why this is happening, but since it is looking less and less like a problem with Reportlab, I'll stop bothering everyone here. If I ever find out exactly what was going on, I'll post here again. Thanks to everyone for all your help, Simon From robin at reportlab.com Wed May 27 08:19:38 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 27 May 2009 13:19:38 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420ACD8@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420ACD8@zuk35exm65.ds.mot.com> Message-ID: <4A1D2FDA.4050909@chamonix.reportlab.co.uk> .......... > > Thanks a lot for testing that. It's beginning to sound like it might be > an issue with the printer driver itself. Does that sound realistic? (I > can reproduce the problem using the Windows driver for an HP Color > LaserJet 8500 PS). > > I would love to understand why this is happening, but since it is > looking less and less like a problem with Reportlab, I'll stop bothering > everyone here. If I ever find out exactly what was going on, I'll post > here again. > > Thanks to everyone for all your help, > > Simon ........ One thing you might try is to trip the RL pdf through postscript. We do this sometimes to see if the problem is caused by our code. Typically we do it by export to postscript from acrobat reader followed by convert to pdf with distiller. If your printer can do it print the postscript and the final pdf. If those are successful they may give information about what's wrong with the RL version. -- Robin Becker From gherman at darwin.in-berlin.de Wed May 27 13:40:51 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 27 May 2009 19:40:51 +0200 Subject: [reportlab-users] Missing area charts Message-ID: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> Hi, I thought I had seen some area charts in the RL library already, but a quick look at the code doesn't reveal any. What I need are stacked area charts, much like line plots, but with all the area below the line filled up to the axis... Thanks, 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 May 27 13:59:29 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 27 May 2009 19:59:29 +0200 Subject: [reportlab-users] Missing area charts In-Reply-To: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> References: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> Message-ID: I wrote: > I thought I had seen some area charts in the RL library already, > but a quick look at the code doesn't reveal any. What I need are > stacked area charts, much like line plots, but with all the area > below the line filled up to the axis... Ok, I found AreaLinePlot, but not a test illustrating it, at least not in a way that would make it instantly visible as an area chart. I guess (and hope) it is implicitly stacked (in- heriting from LinePlot with multiple series)... Anyway, thanks! Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Thu May 28 03:20:23 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 28 May 2009 08:20:23 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1D141A.8030302@chamonix.reportlab.co.uk> References: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> <4A1D141A.8030302@chamonix.reportlab.co.uk> Message-ID: <956003ae0905280020v770de0c4ya485d8d51939bb65@mail.gmail.com> 2009/5/27 Robin Becker : > ...... > both, we use many windows fonts as ttfs and all seem to print OK on our > laserjet 1010. I just printed your "Some text in Arial Unicode MS" example > and that worked fine. > -- I'm dredging up ten-year-old memories here but it depends what is driving the laserjet. First, it at least used to be possible to use HP LaserJets with either PCL drivers (the default on Windows) or postscript drivers (the default on Mac). Secondly, AcroRead on Windows may not be using Postscript at all - Windows has its own printing system involving sending graphics to the printer as a 'device context' (sort of like our canvas). Macs used to use Postscript between the computer and printer but I don't know these days. So a positive print on our office laser from Windows doesn't rule out a problem with the file entirely. But it could be a buggy printer driver. - Andy From simon.king at motorola.com Thu May 28 04:36:54 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Thu, 28 May 2009 09:36:54 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1D2FDA.4050909@chamonix.reportlab.co.uk> Message-ID: <8D20BBB55F590E42AADF592A815E86170420AECC@zuk35exm65.ds.mot.com> Robin Becker wrote: > One thing you might try is to trip the RL pdf through > postscript. We do this > sometimes to see if the problem is caused by our code. > Typically we do it by > export to postscript from acrobat reader followed by convert > to pdf with > distiller. If your printer can do it print the postscript and > the final pdf. If > those are successful they may give information about what's > wrong with the RL > version. Hi Robin, I can't get Acrobat Reader 9 on Linux (Ubuntu 8.10) to convert the 'Some text in Arial Unicode MS' PDF to Postscript using "acroread -toPostScript " - it just displays the filename followed by a colon, with no error message, and generates no postscript file. The same command on a completely different PDF generated a PostScript file as expected. Do you have a copy of Acrobat Reader on Linux that you can check this with? Thanks, Simon From robin at reportlab.com Thu May 28 05:23:49 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 28 May 2009 10:23:49 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420AECC@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420AECC@zuk35exm65.ds.mot.com> Message-ID: <4A1E5825.9070009@chamonix.reportlab.co.uk> King Simon-NFHD78 wrote: ........ > Hi Robin, > > I can't get Acrobat Reader 9 on Linux (Ubuntu 8.10) to convert the 'Some > text in Arial Unicode MS' PDF to Postscript using "acroread > -toPostScript " - it just displays the filename followed by > a colon, with no error message, and generates no postscript file. The > same command on a completely different PDF generated a PostScript file > as expected. > > Do you have a copy of Acrobat Reader on Linux that you can check this > with? > > Thanks, > > Simon >....... my colleague tried and got problems with your test pdf. We tried with some of our other pdfs using vera.ttf etc and those work. I tried the conversion on win xp and that also fails. Can you post the script that was used to make the pdf? -- Robin Becker From simon.king at motorola.com Thu May 28 05:30:01 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Thu, 28 May 2009 10:30:01 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1E5825.9070009@chamonix.reportlab.co.uk> Message-ID: <8D20BBB55F590E42AADF592A815E86170420AF01@zuk35exm65.ds.mot.com> Robin Becker wrote: > King Simon-NFHD78 wrote: > ........ > > Hi Robin, > > > > I can't get Acrobat Reader 9 on Linux (Ubuntu 8.10) to > convert the 'Some > > text in Arial Unicode MS' PDF to Postscript using "acroread > > -toPostScript " - it just displays the > filename followed by > > a colon, with no error message, and generates no postscript > file. The > > same command on a completely different PDF generated a > PostScript file > > as expected. > > > > Do you have a copy of Acrobat Reader on Linux that you can > check this > > with? > > > > Thanks, > > > > Simon > >....... > my colleague tried and got problems with your test pdf. We > tried with some of > our other pdfs using vera.ttf etc and those work. > > I tried the conversion on win xp and that also fails. > > Can you post the script that was used to make the pdf? Phew - I was beginning to think that I was going mad. Here's the script: #------------ from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont pdfmetrics.registerFont(TTFont('Arial Unicode MS', 'ARIALUNI.ttf')) c = canvas.Canvas('arialtest.pdf') c.setFont('Arial Unicode MS', 32) c.drawString(10, 150, u"Some text in Arial Unicode MS") c.showPage() c.save() #------------ I think the PDF I posted was generated with ReportLab 2.2, but I've tested it with 2.3 and the problem still remains. Simon From robin at reportlab.com Thu May 28 09:14:05 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 28 May 2009 14:14:05 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <8D20BBB55F590E42AADF592A815E86170420AF01@zuk35exm65.ds.mot.com> References: <8D20BBB55F590E42AADF592A815E86170420AF01@zuk35exm65.ds.mot.com> Message-ID: <4A1E8E1D.4000104@chamonix.reportlab.co.uk> madness indeed, I can't run that as I don't have the file arialuni.ttf any more. I have tried with ordinary MS arial and that works fine; however, when I use MS Mincho I am getting an error converting to postscript. Either we're doing something wrong or the font flags etc etc are doing something to stop the conversion. -- Robin Becker From timr at probo.com Thu May 28 13:31:50 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 28 May 2009 10:31:50 -0700 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <956003ae0905280020v770de0c4ya485d8d51939bb65@mail.gmail.com> References: <8D20BBB55F590E42AADF592A815E86170420AC7A@zuk35exm65.ds.mot.com> <4A1D141A.8030302@chamonix.reportlab.co.uk> <956003ae0905280020v770de0c4ya485d8d51939bb65@mail.gmail.com> Message-ID: <4A1ECA86.9020205@probo.com> Andy Robinson wrote: > 2009/5/27 Robin Becker : > >> ...... >> both, we use many windows fonts as ttfs and all seem to print OK on our >> laserjet 1010. I just printed your "Some text in Arial Unicode MS" example >> and that worked fine. >> > > I'm dredging up ten-year-old memories here but it depends what is > driving the laserjet. > > First, it at least used to be possible to use HP LaserJets with either > PCL drivers (the default on Windows) or postscript drivers (the > default on Mac). This is true, but only if the printer supports both. All HP printers support PCL. Only some support Postscript. It looks to me like the LaserJet 1010 is PCL only, and a stripped-down version of PCL at that, without any native font support. It's a simple, stupid, raster bitmap renderer. > Secondly, AcroRead on Windows may not be using > Postscript at all - Windows has its own printing system involving > sending graphics to the printer as a 'device context' (sort of like > our canvas). > Yes, but... if the printer has a Postscript driver, Acrobat uses the Windows "passthrough" mechanism to send Postscript directly to the printer. After all, Adobe wrote the Windows Postscript driver, so they have a pretty good understanding of how to make it do tricks. For the LJ1010, what you say is spot on: Acrobat converts the Postscript to GDI, then the driver converts GDI to PCL. > Macs used to use Postscript between the computer and printer but I > don't know these days. > Of course, that only applies if the printer speaks Postscript.... -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From gherman at darwin.in-berlin.de Thu May 28 16:12:06 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 28 May 2009 22:12:06 +0200 Subject: [reportlab-users] Missing area charts In-Reply-To: References: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> Message-ID: <4A9EB057-B621-46CA-884B-B781F95106C0@darwin.in-berlin.de> Dinu Gherman: > Ok, I found AreaLinePlot, but not a test illustrating it, at > least not in a way that would make it instantly visible as an > area chart. I guess (and hope) it is implicitly stacked (in- > heriting from LinePlot with multiple series)... Maybe I was overly optimistic... While trying AreaLinePlot like it is (or rather: like it should be) used on page 155 of the file graphics_reference.pdf I get an error like this: [...] /reportlab/graphics/charts/lineplots.py", line 748, in draw S[j] = S[j] + odata[j][i] TypeError: unsupported operand type(s) for +: 'int' and 'tuple' Is this expected to work and if so, where can I find some sample or test code proving that it really works? Thanks, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From mr.rech.list at gmail.com Thu May 28 16:14:07 2009 From: mr.rech.list at gmail.com (Andrea Riciputi) Date: Thu, 28 May 2009 22:14:07 +0200 Subject: [reportlab-users] Installing on Mac OSX Message-ID: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> Hi all, I'd like to give ReportLab a try, but I'm having some trouble installing it on my Mac. Maybe someone here can help me to figure out to get it done. At the moment I'm using the Python distribution provided by Apple on OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab via easy_install I get the following error: > ld: library not found for -l_renderPM_libart > ld: library not found for -l_renderPM_libart I'm not sure, but I think this issue can be related to the lack of freetype2 from OSX. Is freetype2 mandatory to get ReporLab up and runnning? Can anyone give me some hints or a recipe about how to install ReportLab on OSX? Thanks in advance, Andrea From aaron.barlow at gmail.com Thu May 28 16:17:11 2009 From: aaron.barlow at gmail.com (Aaron Barlow) Date: Thu, 28 May 2009 14:17:11 -0600 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> Message-ID: <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> Andrea, I've installed Reportlab on several Mac, but you can't use easy_install do to because of some of the required dependencies (i.e. FreeType and PIL). You'll have better success installing ReportLab and its dependencies from source. -- Aaron On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: > Hi all, > I'd like to give ReportLab a try, but I'm having some trouble > installing it on my Mac. Maybe someone here can help me to figure > out to get it done. > > At the moment I'm using the Python distribution provided by Apple on > OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab via > easy_install I get the following error: > >> ld: library not found for -l_renderPM_libart >> ld: library not found for -l_renderPM_libart > > I'm not sure, but I think this issue can be related to the lack of > freetype2 from OSX. Is freetype2 mandatory to get ReporLab up and > runnning? Can anyone give me some hints or a recipe about how to > install ReportLab on OSX? > > Thanks in advance, > Andrea_______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From mr.rech.list at gmail.com Thu May 28 16:21:34 2009 From: mr.rech.list at gmail.com (Andrea Riciputi) Date: Thu, 28 May 2009 22:21:34 +0200 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> Message-ID: <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> Hi Aaron, installing FreeType and PIL from sources scares me a little bit. Both of them are quite big packages and I can imagine they also have many dependencies in turn. Could you be so kind to give me some more details about the procedure? TIA, Andrea On 28 May, 2009, at 22:17, Aaron Barlow wrote: > Andrea, > > I've installed Reportlab on several Mac, but you can't use > easy_install do to because of some of the required dependencies > (i.e. FreeType and PIL). You'll have better success installing > ReportLab and its dependencies from source. > > -- > Aaron > > On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: > >> Hi all, >> I'd like to give ReportLab a try, but I'm having some trouble >> installing it on my Mac. Maybe someone here can help me to figure >> out to get it done. >> >> At the moment I'm using the Python distribution provided by Apple >> on OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab via >> easy_install I get the following error: >> >>> ld: library not found for -l_renderPM_libart >>> ld: library not found for -l_renderPM_libart >> >> I'm not sure, but I think this issue can be related to the lack of >> freetype2 from OSX. Is freetype2 mandatory to get ReporLab up and >> runnning? Can anyone give me some hints or a recipe about how to >> install ReportLab on OSX? >> >> Thanks in advance, >> Andrea_______________________________________________ >> reportlab-users mailing list >> reportlab-users at reportlab.com >> http://two.pairlist.net/mailman/listinfo/reportlab-users > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From aaron.barlow at gmail.com Thu May 28 16:36:14 2009 From: aaron.barlow at gmail.com (Aaron Barlow) Date: Thu, 28 May 2009 14:36:14 -0600 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> Message-ID: Andrea, It's been a little while since I've done either, but here goes. I am assuming that you have the Mac OS X developer tools installed. Otherwise, none of the rest will work. freetype2 installs from source without any problems and if I remember correctly doesn't require any dependencies. It's default location is / usr/local and should be fine to leave that there. To get the most of PIL, it needs the libjpeg library which you should be able to download and compile from source. It should also install to /usr/local by default. If you've made it this far, the rest is pretty easy. To install PIL and ReportLab is a matter of downloading the source and running python setup.py in their respective source folders. -- Aaron On May 28, 2009, at 2:21 PM, Andrea Riciputi wrote: > Hi Aaron, > installing FreeType and PIL from sources scares me a little bit. > Both of them are quite big packages and I can imagine they also have > many dependencies in turn. Could you be so kind to give me some more > details about the procedure? > > TIA, > Andrea > > On 28 May, 2009, at 22:17, Aaron Barlow wrote: > >> Andrea, >> >> I've installed Reportlab on several Mac, but you can't use >> easy_install do to because of some of the required dependencies >> (i.e. FreeType and PIL). You'll have better success installing >> ReportLab and its dependencies from source. >> >> -- >> Aaron >> >> On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: >> >>> Hi all, >>> I'd like to give ReportLab a try, but I'm having some trouble >>> installing it on my Mac. Maybe someone here can help me to figure >>> out to get it done. >>> >>> At the moment I'm using the Python distribution provided by Apple >>> on OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab >>> via easy_install I get the following error: >>> >>>> ld: library not found for -l_renderPM_libart >>>> ld: library not found for -l_renderPM_libart >>> >>> I'm not sure, but I think this issue can be related to the lack of >>> freetype2 from OSX. Is freetype2 mandatory to get ReporLab up and >>> runnning? Can anyone give me some hints or a recipe about how to >>> install ReportLab on OSX? >>> >>> Thanks in advance, >>> Andrea_______________________________________________ >>> 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 From mr.rech.list at gmail.com Thu May 28 16:42:23 2009 From: mr.rech.list at gmail.com (Andrea Riciputi) Date: Thu, 28 May 2009 22:42:23 +0200 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> Message-ID: <2CA76819-2D55-45A5-A1B1-49953D1EDE95@gmail.com> Thanks a lot Aaron, I'll try it out tomorrow morning. Hope for the best. I'll let you know. Cheers, Andrea On 28 May, 2009, at 22:36, Aaron Barlow wrote: > Andrea, > > It's been a little while since I've done either, but here goes. I am > assuming that you have the Mac OS X developer tools installed. > Otherwise, none of the rest will work. > > freetype2 installs from source without any problems and if I > remember correctly doesn't require any dependencies. It's default > location is /usr/local and should be fine to leave that there. > > To get the most of PIL, it needs the libjpeg library which you > should be able to download and compile from source. It should also > install to /usr/local by default. > > If you've made it this far, the rest is pretty easy. To install PIL > and ReportLab is a matter of downloading the source and running > python setup.py in their respective source folders. > > -- > Aaron > > On May 28, 2009, at 2:21 PM, Andrea Riciputi wrote: > >> Hi Aaron, >> installing FreeType and PIL from sources scares me a little bit. >> Both of them are quite big packages and I can imagine they also >> have many dependencies in turn. Could you be so kind to give me >> some more details about the procedure? >> >> TIA, >> Andrea >> >> On 28 May, 2009, at 22:17, Aaron Barlow wrote: >> >>> Andrea, >>> >>> I've installed Reportlab on several Mac, but you can't use >>> easy_install do to because of some of the required dependencies >>> (i.e. FreeType and PIL). You'll have better success installing >>> ReportLab and its dependencies from source. >>> >>> -- >>> Aaron >>> >>> On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: >>> >>>> Hi all, >>>> I'd like to give ReportLab a try, but I'm having some trouble >>>> installing it on my Mac. Maybe someone here can help me to figure >>>> out to get it done. >>>> >>>> At the moment I'm using the Python distribution provided by Apple >>>> on OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab >>>> via easy_install I get the following error: >>>> >>>>> ld: library not found for -l_renderPM_libart >>>>> ld: library not found for -l_renderPM_libart >>>> >>>> I'm not sure, but I think this issue can be related to the lack >>>> of freetype2 from OSX. Is freetype2 mandatory to get ReporLab up >>>> and runnning? Can anyone give me some hints or a recipe about how >>>> to install ReportLab on OSX? >>>> >>>> Thanks in advance, >>>> Andrea_______________________________________________ >>>> 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 > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From paul.barrass at safeonlinebilling.com Thu May 28 17:33:07 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Thu, 28 May 2009 22:33:07 +0100 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> Message-ID: <4A1F0313.6040906@safeonlinebilling.com> Aaron Barlow wrote: > Andrea, > > I've installed Reportlab on several Mac, but you can't use > easy_install do to because of some of the required dependencies (i.e. > FreeType and PIL). You'll have better success installing ReportLab and > its dependencies from source. It (probably) won't be necessary to install FreeType and PIL from source if you install the packages and the -devel packages (or Mac equivalents, not something I've ever tried). Installing RL from the install tarball is the supported option (and just a matter of make install) - easy_install is explicitly unsupported. I was under the impression that both FT and PIL were both optional dependencies (though highly recommended), so you might not have to worry about them if you just want a quick try out, maybe someone more in the know will let you know when they see your problems. Paul Barrass. From johnkeyes at gmail.com Thu May 28 17:46:28 2009 From: johnkeyes at gmail.com (John Keyes) Date: Thu, 28 May 2009 22:46:28 +0100 Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> Message-ID: <4A1F0634.8070403@gmail.com> Hi Andrea, I installed everything from source not too long ago but I didn't document everything. It was a pretty straightforward process to get ReportLab installed from what I remember. If you run into any difficulties post back here and I'll try to help out. Cheers, -John K Andrea Riciputi wrote: > Hi Aaron, > installing FreeType and PIL from sources scares me a little bit. Both > of them are quite big packages and I can imagine they also have many > dependencies in turn. Could you be so kind to give me some more > details about the procedure? > > TIA, > Andrea > > On 28 May, 2009, at 22:17, Aaron Barlow wrote: > >> Andrea, >> >> I've installed Reportlab on several Mac, but you can't use >> easy_install do to because of some of the required dependencies (i.e. >> FreeType and PIL). You'll have better success installing ReportLab >> and its dependencies from source. >> >> -- >> Aaron >> >> On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: >> >>> Hi all, >>> I'd like to give ReportLab a try, but I'm having some trouble >>> installing it on my Mac. Maybe someone here can help me to figure >>> out to get it done. >>> >>> At the moment I'm using the Python distribution provided by Apple on >>> OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab via >>> easy_install I get the following error: >>> >>>> ld: library not found for -l_renderPM_libart >>>> ld: library not found for -l_renderPM_libart >>> >>> I'm not sure, but I think this issue can be related to the lack of >>> freetype2 from OSX. Is freetype2 mandatory to get ReporLab up and >>> runnning? Can anyone give me some hints or a recipe about how to >>> install ReportLab on OSX? >>> >>> Thanks in advance, >>> Andrea_______________________________________________ >>> 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 From janssen at parc.com Thu May 28 17:53:20 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 28 May 2009 14:53:20 PDT Subject: [reportlab-users] Installing on Mac OSX In-Reply-To: References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> Message-ID: <62913.1243547600@parc.com> Andrea Riciputi wrote: > Hi Aaron, > installing FreeType and PIL from sources scares me a little bit. Both > of them are quite big packages and I can imagine they also have many > dependencies in turn. Could you be so kind to give me some more > details about the procedure? I do it all the time. Here's a script I use on Macs. Put all the prereqs .tar.gz files in a directory, the PREREQS-DIR, and then invoke this script, giving the PREREQS-DIR and where you want it installed (e.g. "/usr/local") as arguments. I'll let you figure out exactly what .tar.gz (.tgz or .tar.bz2 will also work) files you need -- read the script closely to make up that list. Bill ------------------------------------------------------------ #!/bin/csh # if ($# < 1) then echo "Usage: $0 PREREQS-DIR INSTALL-DIR" exit 1 endif set prereqdir=$1 set distdir=$2 set shorthostname=`/bin/hostname` set ourhostname=`/usr/bin/host $shorthostname | /usr/bin/awk '{print $1}'` if (-e ${distdir}) then if ( ! -d ${distdir} ) then echo "Can't install to file ${distdir}." exit 1 endif else mkdir -p ${distdir} endif mkdir -p ${distdir}/man/man1 rm -rf /tmp/install-reportlab-prereqs mkdir -p /tmp/install-reportlab-prereqs pushd /tmp/install-reportlab-prereqs foreach file ( ${prereqdir}/*.tar.gz ${prereqdir}/*.tgz ) tar xvfz $file end foreach file ( ${prereqdir}/*.tar.bz2 ) bunzip2 < $file | tar xvf - end cd libpng-* ./configure --prefix=${distdir} make make install cd ../jpeg* ./configure --prefix=${distdir} make make install make install-lib make install-headers ranlib ${distdir}/lib/libjpeg.a cd ../jbig2dec* setenv CPPFLAGS "-I${distdir}/include" setenv LDFLAGS "-L${distdir}/lib" setenv CXXFLAGS "-I${distdir}/include" ./configure --prefix=${distdir} make make install cd ../tiff-* ./configure --prefix=${distdir} make make install cd ../freetype-2.* # first, get rid of erroneous mac flag rm -f /tmp/foo-mac-reportlab cp include/freetype/config/ftconfig.h /tmp/foo-mac-reportlab rm -f include/freetype/config/ftconfig.h sed -e 's/#define FT_MACINTOSH 1/#undef FT_MACINTOSH/' < /tmp/foo-mac-reportlab > include/freetype/config/ftconfig.h # next, enable the bytecode interpreter rm -f /tmp/foo-mac-reportlab cp include/freetype/config/ftoption.h /tmp/foo-mac-reportlab rm -f include/freetype/config/ftoption.h sed -e 's;/\* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER \*/;#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER;' < /tmp/foo-mac-reportlab > include/freetype/config/ftoption.h # now build ./configure --prefix=${distdir} make make install cp ${distdir}/include/ft2build.h ${distdir}/include/freetype2/ # for xpdf cd ../t1lib-5.* ./configure --without-x --without-athena --prefix=${distdir} make without_doc make install cd ../Imaging-1.1.* rm -f /tmp/foo-mac-reportlab cp setup.py /tmp/foo-mac-reportlab sed -e "s;/sw;${distdir};" < /tmp/foo-mac-reportlab > setup.py python setup.py build python setup.py install cd ../ReportLab_2* python setup.py build python setup.py install From marius at gedmin.as Thu May 28 18:58:49 2009 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 29 May 2009 01:58:49 +0300 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <4A1E8E1D.4000104@chamonix.reportlab.co.uk> References: <8D20BBB55F590E42AADF592A815E86170420AF01@zuk35exm65.ds.mot.com> <4A1E8E1D.4000104@chamonix.reportlab.co.uk> Message-ID: <20090528225849.GB1431@platonas> On Thu, May 28, 2009 at 02:14:05PM +0100, Robin Becker wrote: > madness indeed, > > I can't run that as I don't have the file arialuni.ttf any more. > > I have tried with ordinary MS arial and that works fine; however, when I > use MS Mincho I am getting an error converting to postscript. Either > we're doing something wrong or the font flags etc etc are doing something > to stop the conversion. Is there any way to trigger the problem on Linux (e.g. with ghostscript)? I'm curious and wouldn't mind spending a little time debugging. Marius Gedminas -- C is for Cookies. Perl is even better for Cookies. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From simon.king at motorola.com Fri May 29 05:01:25 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Fri, 29 May 2009 10:01:25 +0100 Subject: [reportlab-users] PDFs generated by ReportLab not printing In-Reply-To: <20090528225849.GB1431@platonas> Message-ID: <8D20BBB55F590E42AADF592A815E86170420B1CC@zuk35exm65.ds.mot.com> Marius Gedminas wrote: > > Is there any way to trigger the problem on Linux (e.g. with > ghostscript)? > > I'm curious and wouldn't mind spending a little time debugging. > Hi Marius, Acrobat Reader on Linux is unable to convert the PDF to PostScript (using acroread -toPostScript). However, pdf2ps does work. I don't know ghostscript well enough to know if there is any other way I could try to reproduce the problem. As far as creating the PDF goes, if you have the font 'Arial Unicode MS' (which is distributed as part of MS Office), then the script that I posted earlier creates the faulty PDF on linux as well. I think 'Arial Unicode MS' is also distributed with Mac OS X - I've no idea whether that version of the font has the same issues. If you are interested I could send you the font file off list, but it is 23Mb. I don't know what other fonts trigger the issue. I don't know whether it's important, but when I run something similar to the ghostscript command that pdf2ps uses, I get the following output: # gs -sDEVICE=pswrite -dNOPAUSE -dBATCH -sOutputFile=arialtest9.ps -f arialtest9.pdf GPL Ghostscript 8.61 (2007-11-21) Copyright (C) 2007 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 1. Page 1 Loading NimbusSanL-Regu font from /var/lib/defoma/gs.d/dirs/fonts/n019003l.pfb... 2914644 1348874 2707756 1132476 3 done. Why is ghostscript loading Nimbus Sans? Is it replacing the font that's in the PDF file in some way? Thanks, Simon From robin at reportlab.com Fri May 29 06:30:10 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 29 May 2009 11:30:10 +0100 Subject: [reportlab-users] Missing area charts In-Reply-To: <4A9EB057-B621-46CA-884B-B781F95106C0@darwin.in-berlin.de> References: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> <4A9EB057-B621-46CA-884B-B781F95106C0@darwin.in-berlin.de> Message-ID: <4A1FB932.9040805@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Dinu Gherman: > >> Ok, I found AreaLinePlot, but not a test illustrating it, at >> least not in a way that would make it instantly visible as an >> area chart. I guess (and hope) it is implicitly stacked (in- >> heriting from LinePlot with multiple series)... > > > Maybe I was overly optimistic... While trying AreaLinePlot like > it is (or rather: like it should be) used on page 155 of the file > graphics_reference.pdf I get an error like this: > > [...] > /reportlab/graphics/charts/lineplots.py", line 748, in draw > S[j] = S[j] + odata[j][i] > TypeError: unsupported operand type(s) for +: 'int' and 'tuple' > > Is this expected to work and if so, where can I find some sample > or test code proving that it really works? > > Thanks, > > Dinu > from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.lineplots import AreaLinePlot class Drawing_000(Drawing): def __init__(self,width=400,height=200,*args,**kw): Drawing.__init__(*((self,width,height)+args),**kw) self.add(AreaLinePlot()) self.contents[0].y = 20 self.contents[0].width = 360 self.contents[0].height = 170 if __name__=="__main__": #NORUNTESTS Drawing_000().save(formats=['pdf'],outDir='.',fnRoot=None) -- Robin Becker From mr.rech.list at gmail.com Fri May 29 07:10:47 2009 From: mr.rech.list at gmail.com (Andrea Riciputi) Date: Fri, 29 May 2009 13:10:47 +0200 Subject: [reportlab-users] Installing on Mac OSX [SOLVED] In-Reply-To: <4A1F0634.8070403@gmail.com> References: <741EA6B1-B990-45F2-B83A-D5B10B5B2E1A@gmail.com> <76F65BE7-5B0B-4998-BCC0-B1598A88785E@gmail.com> <56236476-D319-4448-8650-7BC502DECEBA@gmail.com> <4A1F0634.8070403@gmail.com> Message-ID: Hi, I must thank you all for your support. Actually installing ReportLab on my Mac (OSX 10.5, Apple's Python 2.5.1) was easier than expected. Here it is the (not so short) recipe to get it done, just in case anyone else will need it again. First of all easy_install: ReportLab (RL hereafter) doesn't build properly using easy_install (at least at the time of this writing). It is unfortunate that if you try to run "% easy_install reportlab" from your shell prompt the package get downloaded and the compilation process begin, failing with an error message that can leave the unware user a little bit puzzled. I'd suggest RL people to make the easy_install process explicitly unavailable, like PIL people did. (If you try "% easy_install pil" you get a much more explicit message: "No local packages or download links found for pil") Now you should first take care of the dependencies: ReportLab depends on FreeType2 and PIL. The latter depends on FreeType2, jpeglib, zlib, and Tkinter (as reported in PIL documentation). Tkinter is already installed on OSX so, before installing RL, you must first install: libjpeg, zlib, FT2, and PIL. Since I'm not much fond of installing big pagkages from source I chose to install them using Macports (). You can also use Fink () if you prefer, fortunately both PIL and RL are smart enough to find all the required libraries in the MacPorts/Finks default paths. So using MacPorts, just type in: % port install jpeg zlib freetype after a while you should get all the libraries installed. At this point, I'd strongly suggest to you to create a virtual environment (read here ) to install and play with PIL and RL. Once you virtual enviroment is set and active, get the PIL tarball from expand it, enter the expanded directory, and follow the README instructions: % python setup.py build_ext -i % python selftest.py (optional) % python setup.py install Everything should be fine. Finally get the RL tarball from , again expand it and cd into the expanded directory, and again follow the INSTALL instructions: % python setup.py install % python setup.py tests (optional) Again everything should be fine, or at least was so for me. Hope this could be usefull to other OSX users. Cheers, Andrea On 28 May, 2009, at 23:46, John Keyes wrote: > Hi Andrea, > > I installed everything from source not too long ago but I didn't > document everything. > > It was a pretty straightforward process to get ReportLab installed > from what I remember. If you run into any difficulties post back > here and I'll try to help out. > > Cheers, > -John K > > Andrea Riciputi wrote: >> Hi Aaron, >> installing FreeType and PIL from sources scares me a little bit. >> Both of them are quite big packages and I can imagine they also >> have many dependencies in turn. Could you be so kind to give me >> some more details about the procedure? >> >> TIA, >> Andrea >> >> On 28 May, 2009, at 22:17, Aaron Barlow wrote: >> >>> Andrea, >>> >>> I've installed Reportlab on several Mac, but you can't use >>> easy_install do to because of some of the required dependencies >>> (i.e. FreeType and PIL). You'll have better success installing >>> ReportLab and its dependencies from source. >>> >>> -- >>> Aaron >>> >>> On May 28, 2009, at 2:14 PM, Andrea Riciputi wrote: >>> >>>> Hi all, >>>> I'd like to give ReportLab a try, but I'm having some trouble >>>> installing it on my Mac. Maybe someone here can help me to figure >>>> out to get it done. >>>> >>>> At the moment I'm using the Python distribution provided by Apple >>>> on OSX 10.5, i.e. Python 2.5.2. When I try to install ReportLab >>>> via easy_install I get the following error: >>>> >>>>> ld: library not found for -l_renderPM_libart >>>>> ld: library not found for -l_renderPM_libart >>>> >>>> I'm not sure, but I think this issue can be related to the lack >>>> of freetype2 from OSX. Is freetype2 mandatory to get ReporLab up >>>> and runnning? Can anyone give me some hints or a recipe about how >>>> to install ReportLab on OSX? >>>> >>>> Thanks in advance, >>>> Andrea_______________________________________________ >>>> 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 > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From ralsina at netmanagers.com.ar Fri May 29 10:25:59 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 29 May 2009 11:25:59 -0300 Subject: [reportlab-users] Is borderPadding supposed to do this? Message-ID: <200905291125.59997.ralsina@netmanagers.com.ar> Trying this program: from reportlab.platypus import SimpleDocTemplate, Paragraph from reportlab.lib.styles import ParagraphStyle def go(): Story=[] doc = SimpleDocTemplate("phello.pdf") style = ParagraphStyle(name='border',textColor='#ff0000',backColor='#00ff00',borderPadding=40, borderWidth=2) p = Paragraph('This is a paragraph', style) Story.append(p) p = Paragraph('This is the second paragraph', style) Story.append(p) doc.build(Story) go() I expected to see two largish paragraphs in ugly colours, with big padding, one below the other. What I got was the second paragraph drawn over the first one. -- ("\''/").__..-''"`-. . 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 Fri May 29 10:41:06 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Fri, 29 May 2009 15:41:06 +0100 Subject: [reportlab-users] Is borderPadding supposed to do this? In-Reply-To: <200905291125.59997.ralsina@netmanagers.com.ar> References: <200905291125.59997.ralsina@netmanagers.com.ar> Message-ID: <4A1FF402.4010701@safeonlinebilling.com> Roberto Alsina wrote: > Trying this program: > > > I expected to see two largish paragraphs in ugly colours, with big padding, > one below the other. > > What I got was the second paragraph drawn over the first one. > > The borders on Paragraphs don't take up space in the flow of the document - you'll need to make the Paragraph bigger - adding spaceBefore=40 to the ParagraphStyle might make the script produce what you were expecting. Paul Barrass. From andy at reportlab.com Fri May 29 10:52:13 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 29 May 2009 15:52:13 +0100 Subject: [reportlab-users] Is borderPadding supposed to do this? In-Reply-To: <200905291125.59997.ralsina@netmanagers.com.ar> References: <200905291125.59997.ralsina@netmanagers.com.ar> Message-ID: <956003ae0905290752h755ab4f1k48f2a99fa6c08d9f@mail.gmail.com> 2009/5/29 Roberto Alsina : > I expected to see two largish paragraphs in ugly colours, with big padding, > one below the other. > What I got was the second paragraph drawn over the first one. We don't support the browser "box model" and if you created a paragraph with a really fat border ("borderWidth"), the border line would extend into the ones above and below. This made some sense with border lines, but I accept that your example makes it look silly for an attribute called "borderPadding". This was done to control the extent of the background colour, as the 'natural' bounding box of a paragraph doesn't look natural if you want, say, a black heading on a grey background bar. Unfortunately it was done 2 years ago and is in use in a fair number of projects - usually to have a heading set against a solid text bar with controllable padding - so changing it now would probably break real documents. Paul has suggested the workaround. For ReportLab 3000 we'll probably use CSS semantics - assuming they have stabilised in 991 years time... - Andy From ralsina at netmanagers.com.ar Fri May 29 10:49:40 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 29 May 2009 11:49:40 -0300 Subject: [reportlab-users] Is borderPadding supposed to do this? In-Reply-To: <4A1FF402.4010701@safeonlinebilling.com> References: <200905291125.59997.ralsina@netmanagers.com.ar> <4A1FF402.4010701@safeonlinebilling.com> Message-ID: <200905291149.40226.ralsina@netmanagers.com.ar> On Friday 29 May 2009 11:41:06 Paul Barrass wrote: > Roberto Alsina wrote: > > Trying this program: > > > > > > I expected to see two largish paragraphs in ugly colours, with big > > padding, one below the other. > > > > What I got was the second paragraph drawn over the first one. > > The borders on Paragraphs don't take up space in the flow of the > document - you'll need to make the Paragraph bigger - adding > spaceBefore=40 to the ParagraphStyle might make the script produce what > you were expecting. Not really :-( If I put spaceBefore 40 and spaceAfter 40, the paragraphs still overlap, because the space in the middle is merged. -- ("\''/").__..-''"`-. . 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 Fri May 29 10:58:36 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 29 May 2009 11:58:36 -0300 Subject: [reportlab-users] Is borderPadding supposed to do this? In-Reply-To: <956003ae0905290752h755ab4f1k48f2a99fa6c08d9f@mail.gmail.com> References: <200905291125.59997.ralsina@netmanagers.com.ar> <956003ae0905290752h755ab4f1k48f2a99fa6c08d9f@mail.gmail.com> Message-ID: <200905291158.36900.ralsina@netmanagers.com.ar> On Friday 29 May 2009 11:52:13 Andy Robinson wrote: > We don't support the browser "box model" and if you created a > paragraph with a really fat border ("borderWidth"), the border line > would extend into the ones above and below. Yes, seen that too. > This made some sense with border lines, but I accept that your example > makes it look silly for an attribute called "borderPadding". This was > done to control the extent of the background colour, as the 'natural' > bounding box of a paragraph doesn't look natural if you want, say, a > black heading on a grey background bar. Unfortunately it was done 2 > years ago and is in use in a fair number of projects - usually to have > a heading set against a solid text bar with controllable padding - so > changing it now would probably break real documents. Paul has > suggested the workaround. Strangely, I was trying to do exactly that! I was trying to create a stylesheet that looked like sphinx (http://docs.python.org/library/index.html) and trying to pad the titles without messing the rest of the document. I think I have found a reasonable configuration now, unless someone stacks titles. -- ("\''/").__..-''"`-. . 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 Fri May 29 11:01:33 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Fri, 29 May 2009 16:01:33 +0100 Subject: [reportlab-users] Is borderPadding supposed to do this? In-Reply-To: <956003ae0905290752h755ab4f1k48f2a99fa6c08d9f@mail.gmail.com> References: <200905291125.59997.ralsina@netmanagers.com.ar> <956003ae0905290752h755ab4f1k48f2a99fa6c08d9f@mail.gmail.com> Message-ID: <4A1FF8CD.7050407@safeonlinebilling.com> Andy Robinson wrote: > For ReportLab 3000 we'll probably use CSS semantics - assuming they > have stabilised in 991 years time... > Can I quote you on that release date in 3000AD? ;) Paul. From gherman at darwin.in-berlin.de Fri May 29 11:44:39 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 29 May 2009 17:44:39 +0200 Subject: [reportlab-users] Missing area charts In-Reply-To: <4A1FB932.9040805@chamonix.reportlab.co.uk> References: <6529747F-0301-4ED7-9F57-7BD4A6A9BD23@darwin.in-berlin.de> <4A9EB057-B621-46CA-884B-B781F95106C0@darwin.in-berlin.de> <4A1FB932.9040805@chamonix.reportlab.co.uk> Message-ID: <6CCD81DE-1588-4289-8699-9EF8A35A9C5B@darwin.in-berlin.de> Robin Becker: > from reportlab.graphics.shapes import Drawing > from reportlab.graphics.charts.lineplots import AreaLinePlot > > class Drawing_000(Drawing): > def __init__(self,width=400,height=200,*args,**kw): > Drawing.__init__(*((self,width,height)+args),**kw) > self.add(AreaLinePlot()) > self.contents[0].y = 20 > self.contents[0].width = 360 > self.contents[0].height = 170 > > if __name__=="__main__": #NORUNTESTS > Drawing_000().save(formats=['pdf'],outDir='.',fnRoot=None) Thanks Robin! That makes it just slightly more clear. My version below might be considered even more intuitive, since it also gives a little hint about the format of the data to be passed... It seems like the line color of the areas cannot be set indivi- dually, buy hey, there should be always some room left for im- provements! ;-) Regards, Dinu """ Provide a more intuitive sample for (stacked) area charts compared to the documentation gven by ReportLab. """ from reportlab.lib import colors from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.lineplots import AreaLinePlot from reportlab.graphics.widgets.markers import makeMarker class Drawing_000(Drawing): def __init__(self,width=400,height=200,*args,**kw): Drawing.__init__(*((self,width,height)+args),**kw) p = AreaLinePlot() p.reversePlotOrder = 1 p.yValueAxis.valueMin = 0 # data format: [ # (x_i, y_i_0, y_i_1, ..., y_i_N-1), # (...), # ] p.data = [(0, 1, 1), (1, 0, 1), (2, 1, 0), (3, 3, 3), (4, 1, 1)] p.strokeColor = colors.black p.lines[0].strokeColor = colors.red p.lines[0].symbol = makeMarker('Circle') p.lines[1].strokeColor = colors.blue p.lines[1].symbol = makeMarker('Diamond') self.add(p) self.contents[0].y = 20 self.contents[0].width = 360 self.contents[0].height = 170 if __name__=="__main__": Drawing_000().save(formats=['pdf'],outDir='.',fnRoot=None) ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman -------------- next part -------------- An HTML attachment was scrubbed... URL: From marius at gedmin.as Fri May 29 15:53:45 2009 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 29 May 2009 22:53:45 +0300 Subject: [reportlab-users] CJK fun: AttributeError: FragLine instance has no attribute 'fontName' Message-ID: <20090529195345.GA32468@platonas> Using svn rev 3484 (which is the current HEAD), I'm getting this error on Ubuntu 6.06: Traceback (innermost last): ... File .../reportlab-2.3+svn3484/src/reportlab/platypus/paragraph.py, line 843, in wrap blPara = self.breakLinesCJK([first_line_width, later_widths]) File .../reportlab-2.3+svn3484/src/reportlab/platypus/paragraph.py, line 1227, in breakLinesCJK return cjkFragSplit(self.frags, maxWidths, calcBounds) File .../reportlab-2.3+svn3484/src/reportlab/platypus/paragraph.py, line 733, in cjkFragSplit lines.append(makeCJKParaLine(U[lineStartPos:i],extraSpace,calcBounds)) File .../reportlab-2.3+svn3484/src/reportlab/platypus/paragraph.py, line 684, in makeCJKParaLine if not _sameFrag(f0,f): AttributeError: FragLine instance has no attribute 'fontName' Strangely, the same code works fine on Ubuntu 8.04. Something different in the build environment? A different minor version of Python (Dapper has Python 2.4.3, Hardy has 2.4.5)? This smells like a bug in _rl_accel.c, since the Python version of _sameFrag uses getattr(f, 'fontName', None) and therefore doesn't require that attribute to exist. Of course I had to notice this right after telling the client that we now have working Chinese support, *sigh*. Marius Gedminas -- Voodoo Programming: Things programmers do that they know shouldn't work but they try anyway, and which sometimes actually work, such as recompiling everything. -- Karl Lehenbauer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From marius at gedmin.as Fri May 29 16:00:06 2009 From: marius at gedmin.as (Marius Gedminas) Date: Fri, 29 May 2009 23:00:06 +0300 Subject: [reportlab-users] CJK fun: AttributeError: FragLine instance has no attribute 'fontName' In-Reply-To: <20090529195345.GA32468@platonas> References: <20090529195345.GA32468@platonas> Message-ID: <20090529200006.GA469@platonas> On Fri, May 29, 2009 at 10:53:45PM +0300, Marius Gedminas wrote: > Using svn rev 3484 (which is the current HEAD), I'm getting this error > on Ubuntu 6.06: ... > AttributeError: FragLine instance has no attribute 'fontName' > > Strangely, the same code works fine on Ubuntu 8.04. Something different > in the build environment? A different minor version of Python (Dapper > has Python 2.4.3, Hardy has 2.4.5)? Never mind, it was a version mismatch -- I had a stale _rl_accel.so lying around (from Ubuntu's python2.4-reportlab-accel, version 2.1). Marius Gedminas -- If you sat a monkey down in front of a keyboard, the first thing typed would be a unix command. -- Bill Lye -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From jon at phitz.au.com Fri May 29 20:33:03 2009 From: jon at phitz.au.com (John W) Date: Sat, 30 May 2009 10:33:03 +1000 Subject: [reportlab-users] Missing Font files Message-ID: <4A207EBF.7070505@phitz.au.com> 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 No virus found in this outgoing message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.46/2142 - Release Date: 05/29/09 17:53:00 From paul.barrass at safeonlinebilling.com Sat May 30 06:44:15 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Sat, 30 May 2009 11:44:15 +0100 Subject: [reportlab-users] Missing Font files In-Reply-To: <4A207EBF.7070505@phitz.au.com> References: <4A207EBF.7070505@phitz.au.com> Message-ID: <4A210DFF.8050109@safeonlinebilling.com> John W wrote: > > Trying to use a script that uses the call renderPM.drawToFile > > 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 :-( > 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. > 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. 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.... Paul Barrass