From jayajha at gmail.com Sun Aug 2 01:44:08 2009 From: jayajha at gmail.com (Jaya Jha) Date: Sun, 2 Aug 2009 11:14:08 +0530 Subject: [reportlab-users] Any plans of adding CTL Support? Message-ID: Hi, We have recently started using reportlab through XHTML2PDF and it works excellently. The only problem we are facing is lack of CTL (Complex Text Layout - http://en.wikipedia.org/wiki/Complex_text_layout) support. Was wondering if there are any plans of adding it? Regards Jaya -- Jaya Jha Co-founder and Director Pothi.com Bangalore http://pothi.com -- http://jayajha.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From snitsch at kuhnke.de Sun Aug 2 12:03:08 2009 From: snitsch at kuhnke.de (snitsch at kuhnke.de) Date: Sun, 2 Aug 2009 18:03:08 +0200 Subject: [reportlab-users] =?iso-8859-1?q?Sabine_Nitsch/Malente/Kuhnke_ist?= =?iso-8859-1?q?_au=DFer_Haus=2E?= Message-ID: Ich werde ab 23.07.2009 nicht im B?ro sein. Ich kehre zur?ck am 10.08.2009. Ich werde Ihre Nachrichten nach meiner R?ckkehr beantworten. I will answer your messages after my return. ----------------------------------------------------------- Kuhnke Automation GmbH & Co. KG Amtsgericht L?beck: HRA 4887 HL Ust-IdNr.: DE 814 734 756 Pers. haft. Gesellschafterin: 2. Kuhnke Verwaltungsgesellschaft mbH Sitz der Gesellschaft: Malente Amtsgericht L?beck: HRB 7029 HL Gesch?ftsf?hrer: Wolfgang Schumacher (Sprecher), Robert Lewin ----------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From volker.haas at brainbot.com Mon Aug 3 04:18:53 2009 From: volker.haas at brainbot.com (Volker Haas) Date: Mon, 03 Aug 2009 10:18:53 +0200 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A707798.3040803@chamonix.reportlab.co.uk> References: <4A6EA537.4040906@brainbot.com> <4A707798.3040803@chamonix.reportlab.co.uk> Message-ID: <4A769D6D.9040709@brainbot.com> Robin Becker wrote: > ..... > Volker, I have re-arranged the code in the CJK break lines function > and I think it now works in that it allows splitting in the > multi-fragment case. > > I attach a zip containing the modified paragraph.py. Can you try this > out? Hi Robin, thanks for the fix. The minimal example works now and I didn't notice any side effects. Regards, Volker -- volker haas brainbot technologies ag fon +49 6131 2116394 boppstra?e 64 fax +49 6131 2116392 55118 mainz volker.haas at brainbot.com http://www.brainbot.com/ From robin at reportlab.com Mon Aug 3 04:56:22 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 03 Aug 2009 09:56:22 +0100 Subject: [reportlab-users] cjk splitting problem In-Reply-To: <4A769D6D.9040709@brainbot.com> References: <4A6EA537.4040906@brainbot.com> <4A707798.3040803@chamonix.reportlab.co.uk> <4A769D6D.9040709@brainbot.com> Message-ID: <4A76A636.7080105@chamonix.reportlab.co.uk> Volker Haas wrote: > > > Robin Becker wrote: >> ..... >> Volker, I have re-arranged the code in the CJK break lines function >> and I think it now works in that it allows splitting in the >> multi-fragment case. >> >> I attach a zip containing the modified paragraph.py. Can you try this >> out? > Hi Robin, > thanks for the fix. The minimal example works now and I didn't notice > any side effects. ....... OK I'll check in that change and a splitting test. -- Robin Becker From mdriscoll at co.marshall.ia.us Mon Aug 3 14:53:54 2009 From: mdriscoll at co.marshall.ia.us (Mike Driscoll) Date: Mon, 03 Aug 2009 13:53:54 -0500 Subject: [reportlab-users] Getting Nested table aligned to top In-Reply-To: <4A72B7CD.3000406@chamonix.reportlab.co.uk> References: <4A71F809.50909@co.marshall.ia.us> <4A72B7CD.3000406@chamonix.reportlab.co.uk> Message-ID: <4A773242.40701@co.marshall.ia.us> Hi Robin, > Mike Driscoll wrote: >> Hi, >> >> It looks like my post got eaten due to my screenshot, so I have >> uploaded it to flickr: >> http://www.flickr.com/photos/25220999 at N03/3773123700/ >> >> I am trying to get a set of nested tables to align at the top. There >> are 6 rows in the screenshot. The first row is 3 "Earnings", the 2nd >> is the four row table, the 3rd is three "Deductions", the 4th is the >> 5 row table, etc. Notice that the bottom row has the first two >> columns lower the the last one. Is there a way to force that row to >> be aligned at the top? Right now, I use the following code: >> >> tblThree = Table(data3, colWidths=colWidths, style=LIST_STYLE, >> hAlign="LEFT", vAlign="TOP") >> >> This does not work. Does anyone have a better idea? I am using Python >> 2.5 on Windows XP with the latest ReportLab. >> >> Thanks, >> >> Mike > > This single row example shows nested tables aligned right, top. > > ############################################################### > from reportlab.lib import colors > from reportlab.platypus.doctemplate import SimpleDocTemplate > def getTable(x=0): > data=[('','Europe','Asia'), > ('Quarter 1',100,200), > ('Quarter 2',100,400), > ] > W=[62,26,26] > H=[24,16,16,18] > if x: > data[3:3] = [('Quarter 3',103,404),('Quarter 4',104,396)] > H[3:3] = [16,16] > LR = ['Total',300,600] > for j in xrange(1,len(LR)): > LR[j] = sum([data[i][j] for i in xrange(1,len(data))]) > data.append(LR) > return Table(data,W,H,style=TableStyle([('GRID', (0,0), (-1,-1), > 0.25, colors.black),('FONTSIZE',(0,0),(-1,-1),8)])) > > T=Table([[getTable(0),getTable(0),getTable(1)]], > style=TableStyle([ > ('ALIGN', (0,0), (-1,0), 'RIGHT'), > ('VALIGN', (0,0), (-1,-1), 'TOP'), > ('GRID', (0,0), (-1,-1), 0.25, colors.red), > ]), > ) > SimpleDocTemplate('tnestt.pdf', showBoundary=1).build([T]) > ############################################################### That worked quite well. I don't know why setting "valign" didn't, but I'm glad this worked. Thanks for the example. I had to tweak it a little as three rows were aligning themselves to the left and one to the right, but it's much closer to what it should be. Thanks again, Mike From robin at reportlab.com Tue Aug 4 04:49:11 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 04 Aug 2009 09:49:11 +0100 Subject: [reportlab-users] Getting Nested table aligned to top In-Reply-To: <4A773242.40701@co.marshall.ia.us> References: <4A71F809.50909@co.marshall.ia.us> <4A72B7CD.3000406@chamonix.reportlab.co.uk> <4A773242.40701@co.marshall.ia.us> Message-ID: <4A77F607.8070601@chamonix.reportlab.co.uk> Mike Driscoll wrote: ......... > > That worked quite well. I don't know why setting "valign" didn't, but > I'm glad this worked. Thanks for the example. I had to tweak it a little > as three rows were aligning themselves to the left and one to the right, > but it's much closer to what it should be. > ....... I think that the cell is the container and it just ignores the standard flowable style stuff and uses the cell style instead. That makes sense for simple strings, but less so for flowables. At least it's consistent for cell contents. -- Robin Becker From harijay at gmail.com Tue Aug 4 20:59:26 2009 From: harijay at gmail.com (hari jayaram) Date: Tue, 4 Aug 2009 20:59:26 -0400 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? Message-ID: Hi I have just used reportlab for generating some scientific reports Its a great library and I was up and running in no time to create the reports ( see links below) I noticed however that the text laden pdfs I am rendering are not searchable using Apple Mac (Leopard) OSX Preview.App When I use the built in search within Preview.App only single characters light up ( only single characters show matches like a , b , c , d ) No words light up.. The very same pdfs are searchable in Adobe Acrobat on a PC and in Googles ( GMAIL) built in pdf viewer . The Google pdf viewer even highlights every occurace and gives great statistics. But something about my pdfs make Preview not digest the run of characters as words. Since a lot of the users are Mac users . How can I allow Preview.App to understand that "Peg 400" in my pdf is a word and not p , e , g etc etc.. Thanks a tonne for this great library.. Your help in making my pdfs searchable in Preview.App will be greatly appreciated Hari source : ( http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/platepdfwriter.py ) examples (see http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/example1.pdf ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Tue Aug 4 21:14:29 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 4 Aug 2009 22:14:29 -0300 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: Message-ID: <200908042214.29878.ralsina@netmanagers.com.ar> On Tuesday 04 August 2009 21:59:26 hari jayaram wrote: > Hi I have just used reportlab for generating some scientific reports > Its a great library and I was up and running in no time to create the > reports ( see links below) > > I noticed however that the text laden pdfs I am rendering are not > searchable using Apple Mac (Leopard) OSX Preview.App > > When I use the built in search within Preview.App only single characters > light up ( only single characters show matches like a , b , c , d ) No > words light up.. > > The very same pdfs are searchable in Adobe Acrobat on a PC and in Googles ( > GMAIL) built in pdf viewer . The Google pdf viewer even highlights every > occurace and gives great statistics. > > But something about my pdfs make Preview not digest the run of characters > as words. > Since a lot of the users are Mac users . How can I allow Preview.App to > understand that "Peg 400" in my pdf is a word and not p , e , g etc etc.. > > > Thanks a tonne for this great library.. > Your help in making my pdfs searchable in Preview.App will be greatly > appreciated If every other PDF viewer works, it looks like Preview.App sucks? How are you generating the PDFs, via LaTeX or via rst2pdf? -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From ralsina at netmanagers.com.ar Tue Aug 4 21:16:47 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 4 Aug 2009 22:16:47 -0300 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <200908042214.29878.ralsina@netmanagers.com.ar> References: <200908042214.29878.ralsina@netmanagers.com.ar> Message-ID: <200908042216.47716.ralsina@netmanagers.com.ar> On Tuesday 04 August 2009 22:14:29 Roberto Alsina wrote: This part is reasonable: > If every other PDF viewer works, it looks like Preview.App sucks? This one is because I thought I was reading docutils-users instead of reportlab-users. Sorry! > How are you generating the PDFs, via LaTeX or via rst2pdf? -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From janssen at parc.com Tue Aug 4 22:27:17 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 4 Aug 2009 19:27:17 PDT Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: Message-ID: <69509.1249439237@parc.com> hari jayaram wrote: > I noticed however that the text laden pdfs I am rendering are not searchable > using Apple Mac (Leopard) OSX Preview.App > > When I use the built in search within Preview.App only single characters > light up ( only single characters show matches like a , b , c , d ) No words > light up.. Works fine for me, generating PDFs with ReportLab 2.2 and searching with Preview. I add my text to the PDF a word at a time, with this code: textobj = mycanvas.beginText(word.left, word.baseline) textobj.setTextRenderMode(INVISIBLE_MODE) textstring = word.text.strip().encode('latin-1', 'replace') textobj.textLines(textstring) mycanvas.drawText(textobj) Incidentally, can I switch to UTF-8 these days? Bill From robin at reportlab.com Wed Aug 5 08:19:34 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 05 Aug 2009 13:19:34 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: Message-ID: <4A7978D6.2030605@chamonix.reportlab.co.uk> hari jayaram wrote: .......... > I noticed however that the text laden pdfs I am rendering are not searchable > using Apple Mac (Leopard) OSX Preview.App > > When I use the built in search within Preview.App only single characters > light up ( only single characters show matches like a , b , c , d ) No words > light up.. > > The very same pdfs are searchable in Adobe Acrobat on a PC and in Googles ( > GMAIL) built in pdf viewer . The Google pdf viewer even highlights every > occurace and gives great statistics. > > But something about my pdfs make Preview not digest the run of characters as > words. > Since a lot of the users are Mac users . How can I allow Preview.App to > understand that "Peg 400" in my pdf is a word and not p , e , g etc etc.. ......... Since the document doesn't change presumably the problem lies in this Preview.App. First off can you check that other PDF's are searchable? Also if possible can you supply a minimal reportlab script to make a pdf that fails the test and explain what it is you do to show the search failing? I'm not a mac person, but we do have access to a couple of macs so we can do the testing. I seem to recall that OSX has a global document search facility (like windows search for a file containing a phrase); is that what we're talking about? -- Robin Becker From robin at reportlab.com Wed Aug 5 08:21:03 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 05 Aug 2009 13:21:03 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <69509.1249439237@parc.com> References: <69509.1249439237@parc.com> Message-ID: <4A79792F.50106@chamonix.reportlab.co.uk> Bill Janssen wrote: > hari jayaram wrote: > >> I noticed however that the text laden pdfs I am rendering are not searchable >> using Apple Mac (Leopard) OSX Preview.App >> >> When I use the built in search within Preview.App only single characters >> light up ( only single characters show matches like a , b , c , d ) No words >> light up.. > > Works fine for me, generating PDFs with ReportLab 2.2 and searching with Preview. > > I add my text to the PDF a word at a time, with this code: > > textobj = mycanvas.beginText(word.left, word.baseline) > textobj.setTextRenderMode(INVISIBLE_MODE) > textstring = word.text.strip().encode('latin-1', 'replace') > textobj.textLines(textstring) > mycanvas.drawText(textobj) > > Incidentally, can I switch to UTF-8 these days? > > Bill modern reportlab allows utf8 str or unicode in most places. -- Robin Becker From harijay at gmail.com Wed Aug 5 09:05:53 2009 From: harijay at gmail.com (hari jayaram) Date: Wed, 5 Aug 2009 09:05:53 -0400 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: <69509.1249439237@parc.com> Message-ID: I also tried the test code :import reportlab.pdfgen.canvas as canvas c = canvas.Canvas("searchtext.pdf") c.rotate(90) textobj = c.beginText(10,-10) textstring = "Dispense File Prefix: %s" % "hello world" textobj.textLines(textstring) c.drawText(textobj) c.rotate(-90) c.showPage() c.save() And that gave the attached pdf which fails search for any of the contained text in Preview.App ( Picture 21 .png) I dont know what I am doing wrong Thanks for your help troubleshooting this. Hope the problem does not lie in Preview.App because the same pdfs are searchable in google pdf ( gmail) reader and in Acrobat . Hari On Wed, Aug 5, 2009 at 9:02 AM, hari jayaram wrote: > Hi Bill and Robin ,Thanks for your replies > I tried the textobject way of writing out the string based on the code > snippet you provided . However , the Preview search still does not work. I > think I implemented what you suggested. > > The code snippet is shown here . The older version of my code was using > canvas drawString methods to render the string . The full code is on the > github link ( see below) . That too had the same effect of giving > unsearchable text. > > self.canvas_obj.rotate(90) > textobj = self.canvas_obj.beginText(10,-10) > # textobj.setTextRenderMode(INVISIBLE_MODE) > textstring = "Dispense File Prefix: %s" % > str(os.path.splitext(self.filename)[0] ) > textstring = textstring.strip().encode('latin-1', 'replace') > textobj.textLines(textstring) > self.canvas_obj.drawText(textobj) > # self.canvas_obj.drawString(10,-10,"DispenseFilePrefix: %s" % > str(os.path.splitext(self.filename)[0] )) > self.canvas_obj.rotate(-90) > > Robin, I am trying to search for the Text in the Preview.App search Bar . > This search bar works for every "text" pdf document I have . However If you > see the attached png image or the pdf document , Preview thinks each word > has several spaces in it ..so though visibly the word is present . > Semantically it just seems to be a sequence of alphabets . > > Attachments : github source for report with drawstring methods: > http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/platepdfwriter.py > Png Image showing search result : Picture 20.png, dispense_not_found.png > pdf file failing search rendered with drawText code ( based on Bill Janssens > suggestion): test2.pdf > > Hari > > > > On Tue, Aug 4, 2009 at 10:27 PM, Bill Janssen wrote: > >> hari jayaram wrote: >> >> > I noticed however that the text laden pdfs I am rendering are not >> searchable >> > using Apple Mac (Leopard) OSX Preview.App >> > >> > When I use the built in search within Preview.App only single characters >> > light up ( only single characters show matches like a , b , c , d ) No >> words >> > light up.. >> >> Works fine for me, generating PDFs with ReportLab 2.2 and searching with >> Preview. >> >> I add my text to the PDF a word at a time, with this code: >> >> textobj = mycanvas.beginText(word.left, word.baseline) >> textobj.setTextRenderMode(INVISIBLE_MODE) >> textstring = word.text.strip().encode('latin-1', 'replace') >> textobj.textLines(textstring) >> mycanvas.drawText(textobj) >> >> Incidentally, can I switch to UTF-8 these days? >> >> Bill >> _______________________________________________ >> reportlab-users mailing list >> reportlab-users at reportlab.com >> http://two.pairlist.net/mailman/listinfo/reportlab-users >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: searchtext.pdf Type: application/pdf Size: 1918 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture 21.png Type: image/png Size: 37790 bytes Desc: not available Url : From peter at maubp.freeserve.co.uk Wed Aug 5 09:23:09 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Wed, 5 Aug 2009 14:23:09 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: <69509.1249439237@parc.com> Message-ID: <320fb6e00908050623sd70387ajd9c4940b027d51f8@mail.gmail.com> On Wed, Aug 5, 2009 at 2:05 PM, hari jayaram wrote: > I also tried the test code : > import reportlab.pdfgen.canvas as canvas > c = canvas.Canvas("searchtext.pdf") > c.rotate(90) > textobj = c.beginText(10,-10) > textstring = "Dispense File Prefix: %s" % "hello world" > textobj.textLines(textstring) > c.drawText(textobj) > c.rotate(-90) > c.showPage() > c.save() > And that gave the attached pdf which fails search for any of the contained > text in Preview.App ( Picture 21 .png) > I dont know what I am doing wrong > Thanks for your help troubleshooting this. Hope the problem does not lie in > Preview.App because the same pdfs are searchable in google pdf ( gmail) > reader and in Acrobat . > Hari Confirmed using Mac OS X 10.5.7, and the example script above: Preview Version 4.2 (469.5), does NOT find "hello" Adobe Acrobat Professional 8.1.6 does find "hello" Note that if I remove the rotation, then Apple's Preview search works. This looks like a bug in Apple's Preview tool to me. In case it matters, I'm using this version of report lab: >>> import reportlab >>> reportlab.Version '2.1' >>> reportlab.__version__ ' $Id: __init__.py 3093 2007-05-24 10:08:18Z rgbecker $ ' Peter From gherman at darwin.in-berlin.de Wed Aug 5 10:03:51 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 5 Aug 2009 16:03:51 +0200 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: <69509.1249439237@parc.com> Message-ID: <0C92E6B6-0B02-4499-BB57-E9A960043E9A@darwin.in-berlin.de> hari jayaram: > Thanks for your help troubleshooting this. Hope the problem does not > lie in Preview.App because the same pdfs are searchable in google > pdf ( gmail) reader and in Acrobat . I'm not surprised, since in the past I've also found PDF features unsupported by Apple's Preview.app. One still unsupported seems to be "tooltips" like in the following somewhat dated sample file (on an equally outdated site), that I created with RL: http://python.net/~gherman/tmp/TelcoInvoice.pdf If you hover the mouse over single bars in the calender view you'll see a tooltip in Acrobat, but not in Preview.app. So, yes, using Preview.app too much can be misleading when cre- ating PDF writing software... - pitty! Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From robin at reportlab.com Wed Aug 5 11:13:26 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 05 Aug 2009 16:13:26 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: <69509.1249439237@parc.com> Message-ID: <4A79A196.1060708@chamonix.reportlab.co.uk> hari jayaram wrote: > I also tried the test code :import reportlab.pdfgen.canvas as canvas > c = canvas.Canvas("searchtext.pdf") > c.rotate(90) > textobj = c.beginText(10,-10) > textstring = "Dispense File Prefix: %s" % "hello world" > textobj.textLines(textstring) > c.drawText(textobj) > c.rotate(-90) > c.showPage() > c.save() ....... based on this example and the non-searchability of the rotated version I would guess the problem lies in the preview app. If you just substitutute 0 for 90 & -90 in the above then essentially the same code as for the failing case is issued. Does the preview still fail? If the preview is actually rendering the pdf and then searching, the 0 degrees case should be searchable. If that's the way the search is happening then it's no surprise that the search should fail if the rendered letters are at 90deg. -- Robin Becker From peter at maubp.freeserve.co.uk Wed Aug 5 11:28:38 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Wed, 5 Aug 2009 16:28:38 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <4A79A196.1060708@chamonix.reportlab.co.uk> References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> Message-ID: <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> On Wed, Aug 5, 2009 at 4:13 PM, Robin Becker wrote: > ... I would guess the problem lies in the preview app. > > If you just substitutute 0 for 90 & -90 in the above then essentially the > same code as for the failing case is issued. Does the preview still fail? > > If the preview is actually rendering the pdf and then searching, the 0 > degrees case should be searchable. If that's the way the search is happening > then it's no surprise that the search should fail if the rendered letters > are at 90deg. I just tied this: import reportlab.pdfgen.canvas as canvas c = canvas.Canvas("searchtext.pdf") c.rotate(0) textobj = c.beginText(10,10) textstring = "hello world with rotation of zero!" textobj.textLines(textstring) c.drawText(textobj) c.rotate(0) c.showPage() c.save() And Preview can search this (rotation of 0). I've also got a few other variations to work like 0.1 degrees. But not 60, 89 or 90 degrees. Interestingly at 45 degrees, Preview isn't getting all the words right, some have extra spaces. This means in the following example it can find "hello" and "45" but none of the other words: import reportlab.pdfgen.canvas as canvas c = canvas.Canvas("searchtext.pdf") c.rotate(45) textobj = c.beginText(10,-10) textstring = "hello world with rotation of 45!" textobj.textLines(textstring) c.drawText(textobj) c.rotate(-45) c.showPage() c.save() Peter From harijay at gmail.com Wed Aug 5 11:38:39 2009 From: harijay at gmail.com (hari jayaram) Date: Wed, 5 Aug 2009 11:38:39 -0400 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> Message-ID: Hmm..so It seems that Preview.App can only find things that are partially-rotated or entirely un-rotated. The only reason I am rotating the canvas to render the text is because I want to generate the PDF in a landscape sense (see http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/example1.pdf ) Is there a simpler way to achieve "landscape" rendering than rotating the canvas. Maybe that way may be Preview.App friendly. I have written to one of the apple support discussion lists asking them why Preview treats the PDF differently from every other PDF-reader out there where search works..Lets see if I hear back from the Preview team. Thanks everyone for your emails.. Hari On Wed, Aug 5, 2009 at 11:28 AM, Peter wrote: > On Wed, Aug 5, 2009 at 4:13 PM, Robin Becker wrote: > > ... I would guess the problem lies in the preview app. > > > > If you just substitutute 0 for 90 & -90 in the above then essentially the > > same code as for the failing case is issued. Does the preview still fail? > > > > If the preview is actually rendering the pdf and then searching, the 0 > > degrees case should be searchable. If that's the way the search is > happening > > then it's no surprise that the search should fail if the rendered letters > > are at 90deg. > > I just tied this: > > import reportlab.pdfgen.canvas as canvas > c = canvas.Canvas("searchtext.pdf") > c.rotate(0) > textobj = c.beginText(10,10) > textstring = "hello world with rotation of zero!" > textobj.textLines(textstring) > c.drawText(textobj) > c.rotate(0) > c.showPage() > c.save() > > And Preview can search this (rotation of 0). I've also got a few other > variations to work like 0.1 degrees. But not 60, 89 or 90 degrees. > > Interestingly at 45 degrees, Preview isn't getting all the words right, > some have extra spaces. This means in the following example it > can find "hello" and "45" but none of the other words: > > import reportlab.pdfgen.canvas as canvas > c = canvas.Canvas("searchtext.pdf") > c.rotate(45) > textobj = c.beginText(10,-10) > textstring = "hello world with rotation of 45!" > textobj.textLines(textstring) > c.drawText(textobj) > c.rotate(-45) > c.showPage() > c.save() > > > Peter > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Aug 5 11:52:15 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 05 Aug 2009 16:52:15 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> Message-ID: <4A79AAAF.4010409@chamonix.reportlab.co.uk> hari jayaram wrote: > Hmm..so It seems that Preview.App can only find things that are > partially-rotated or entirely un-rotated. > > The only reason I am rotating the canvas to render the text is because I > want to generate the PDF in a landscape sense (see > http://github.com/harijay/protein-crystallization-gridmaker/blob/1ca03fd8aa85cd18b93ac63ff6447199d9799dcb/example1.pdf > ) > > Is there a simpler way to achieve "landscape" rendering than rotating the > canvas. Maybe that way may be Preview.App friendly. > > I have written to one of the apple support discussion lists asking them why > Preview treats the PDF differently from every other PDF-reader out there > where search works..Lets see if I hear back from the Preview team. > > Thanks everyone for your emails.. > Hari > > ........ It seems that preview is actually looking at the rendered image to find the characters. If the characters are in a string left to right the the words get recognised as contiguous. Displaying vertical text no matter how achieved would seem to bust the algorithm. Peter's partial recog may be because the letters are somewhat contiguous left to right. -- Robin Becker From timr at probo.com Wed Aug 5 12:42:31 2009 From: timr at probo.com (Tim Roberts) Date: Wed, 05 Aug 2009 09:42:31 -0700 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <4A79AAAF.4010409@chamonix.reportlab.co.uk> References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> <4A79AAAF.4010409@chamonix.reportlab.co.uk> Message-ID: <4A79B677.5060904@probo.com> Robin Becker wrote: > ........ > It seems that preview is actually looking at the rendered image to > find the characters. I agree that this matches the symptoms, but as a programmer, how would you do that? The rendered image is just a matrix of pixels. How would you search for words, or even letters, for that matter? When I encounter a bug, I always like to put myself in the mind of the programmer to figure out what thinking would have led to the bug. I'm having a hard time coming up with an implementation that would trigger this. Maybe they are converting the PDF to some kind of intermediate language (like a Windows EMF), where strings that aren't horizontal get converted into a series of smaller strings that ARE horizontal, and they are searching that intermediate format. I'd call that "overthinking the problem". -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From robin at reportlab.com Wed Aug 5 13:03:36 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 05 Aug 2009 18:03:36 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <4A79B677.5060904@probo.com> References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> <4A79AAAF.4010409@chamonix.reportlab.co.uk> <4A79B677.5060904@probo.com> Message-ID: <4A79BB68.3080406@chamonix.reportlab.co.uk> Tim Roberts wrote: > Robin Becker wrote: >> ........ >> It seems that preview is actually looking at the rendered image to >> find the characters. > > I agree that this matches the symptoms, but as a programmer, how would > you do that? The rendered image is just a matrix of pixels. How would > you search for words, or even letters, for that matter? > > When I encounter a bug, I always like to put myself in the mind of the > programmer to figure out what thinking would have led to the bug. I'm > having a hard time coming up with an implementation that would trigger > this. Maybe they are converting the PDF to some kind of intermediate > language (like a Windows EMF), where strings that aren't horizontal get > converted into a series of smaller strings that ARE horizontal, and they > are searching that intermediate format. I'd call that "overthinking the > problem". > I saw some related Preview search problems on one of the tex lists when I was googling. They seemed to be recommending the use of standard fonts and the like to improve searchablity; that would come down to some kind of OCR like weakness. Mac people: are gifs searchable? -- Robin Becker From mjf at pearson.co.uk Wed Aug 5 13:31:48 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Wed, 05 Aug 2009 18:31:48 +0100 Subject: [reportlab-users] Reportlab text not searchable in Apple OSX Preview.App? but searchable in Acrobat and google-pdf viewer ? In-Reply-To: <4A79BB68.3080406@chamonix.reportlab.co.uk> References: <69509.1249439237@parc.com> <4A79A196.1060708@chamonix.reportlab.co.uk> <320fb6e00908050828k28e46720pf994a8304fb5a567@mail.gmail.com> <4A79AAAF.4010409@chamonix.reportlab.co.uk> <4A79B677.5060904@probo.com> <4A79BB68.3080406@chamonix.reportlab.co.uk> Message-ID: <4A79C204.7090505@pearson.co.uk> Robin Becker wrote: > Tim Roberts wrote: >> Robin Becker wrote: >>> ........ >>> It seems that preview is actually looking at the rendered image to >>> find the characters. >> >> I agree that this matches the symptoms, but as a programmer, how would >> you do that? The rendered image is just a matrix of pixels. How would >> you search for words, or even letters, for that matter? >> >> When I encounter a bug, I always like to put myself in the mind of the >> programmer to figure out what thinking would have led to the bug. I'm >> having a hard time coming up with an implementation that would trigger >> this. Maybe they are converting the PDF to some kind of intermediate >> language (like a Windows EMF), where strings that aren't horizontal get >> converted into a series of smaller strings that ARE horizontal, and they >> are searching that intermediate format. I'd call that "overthinking the >> problem". >> > I saw some related Preview search problems on one of the tex lists when > I was googling. They seemed to be recommending the use of standard fonts > and the like to improve searchablity; that would come down to some kind > of OCR like weakness. Mac people: are gifs searchable? I tried a JPEG, and everything on the find menu was greyed out. I made a PDF with the following script, and copy and pasted all the text from Preview into TextEdit. import reportlab.pdfgen.canvas as canvas c = canvas.Canvas("twolines.pdf") c.setFont("Courier", 10) c.rotate(90) c.drawString(0, -10, "ABCDEFG") c.drawString(0, -20, "1234567") c.rotate(-90) c.showPage() c.save() The copy-pasted text I got back was: AB CD E FG 12 34 5 67 Which coincides quite nicely with Tim's suggestion that it's breaking them into shorter strings. -- Matt Folwell From cbrewster at gmail.com Wed Aug 5 17:06:59 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Wed, 5 Aug 2009 23:06:59 +0200 Subject: [reportlab-users] Problems installing Reportlab Message-ID: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. When I run "python setup.py install" I get the following: --- ########## SUMMARY INFO ######### ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ renderPM' # installing with freetype version 21 ################################################ ---- This appears to be good but when I run "python setup.py tests" I get the messages below. Is there anything I have done wrong or what? Thanks for your advice. Christopher ---- christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ python setup.py tests ..........Traceback (most recent call last): File "genuserguide.py", line 104, in main() File "genuserguide.py", line 102, in main run(pagesize, verbose,outDir) File "genuserguide.py", line 53, in run exec open_and_read(f+'.py',mode='t') in G, G File "", line 4 from tools.docco.rl_doc_utils import * ^ SyntaxError: invalid syntax F ...................................................................................................EE ........E ........................................................................ ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_callback.py", line 24, in test0 makeDocument(outputfile('test_pdfgen_callback.pdf'), pageCallBack=self.callMe) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 909, in test0 run(outputfile('test_pdfgen_general.pdf')) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 872, in run c = makeDocument(filename) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a platypus document ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 567, in test0 run() File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 559, in run doc.build(commentary,examples) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 546, in build self.fillFrame(flowables2) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 537, in fillFrame self.handle_flowable(flowables) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/doctemplate.py", line 665, in handle_flowable if frame.add(f, canv, trySplit=self.allowSplitting): File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/frames.py", line 174, in _add flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 105, in drawOn self._drawOn(canvas) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 89, in _drawOn self.draw()#this is the bit you overload File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 396, in draw mask=self._mask, File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 673, in drawImage rawdata = image.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== FAIL: Test if all manuals buildable from source. ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_docs_build.py", line 31, in test0 assert os.path.isfile('reportlab-userguide.pdf'), 'genAll.py failed to generate reportlab-userguide.pdf!' AssertionError: genAll.py failed to generate reportlab-userguide.pdf! ---------------------------------------------------------------------- Ran 193 tests in 57.482s FAILED (failures=1, errors=3) christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ From arkadi at smartbit.be Thu Aug 6 05:03:48 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Thu, 06 Aug 2009 11:03:48 +0200 Subject: [reportlab-users] tinyMCE Message-ID: <4A7A9C74.9060501@smartbit.be> Hi all, Did somebody perhaps already wrote a conversion class for content generated by tinyMCE to reportlab? Html elements like tables, list items, ... Or is there another way to achieve this? best regards, Arkadi Colson From robin at reportlab.com Thu Aug 6 05:28:05 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 06 Aug 2009 10:28:05 +0100 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> Message-ID: <4A7AA225.9070706@chamonix.reportlab.co.uk> Christopher Brewster wrote: > On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. > When I run "python setup.py install" I get the following: > --- ........... > This appears to be good but when I run "python setup.py tests" I get the > messages below. > Is there anything I have done wrong or what? > > Thanks for your advice. > > Christopher > Could this be a line ending conversion error. We don't make MAC specific archives. I always assumed that people used the tar.gz files and that being some kind of unix the mac versions just worked like unix. the import and PIL errors are reminiscent of problem we get when line endings are converted wrongly. ........ -- Robin Becker From dirk.holtwick at gmail.com Thu Aug 6 05:28:10 2009 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Thu, 06 Aug 2009 11:28:10 +0200 Subject: [reportlab-users] tinyMCE In-Reply-To: <4A7A9C74.9060501@smartbit.be> References: <4A7A9C74.9060501@smartbit.be> Message-ID: <4A7AA22A.3090800@gmail.com> http://www.xhtml2pdf.com/demo > Did somebody perhaps already wrote a conversion class for content > generated by tinyMCE to reportlab? Html elements like tables, list > items, ... > Or is there another way to achieve this? > > > best regards, > Arkadi Colson > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From cbrewster at gmail.com Thu Aug 6 08:19:08 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 14:19:08 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <4A7AA225.9070706@chamonix.reportlab.co.uk> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> Message-ID: <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> This certainly helped a lot but I am not sure it worked entirely. Running "sudo python setup.py install" I get: ---- ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ renderPM' # installing with freetype version 21 ################################################ running install running build running build_py copying src/reportlab/lib/hyphen.mashed -> build/lib.macosx-10.3- fat-2.6/reportlab/lib running build_clib building '_renderPM_libart' library building '_renderPM_gt1' library running build_ext running install_lib copying build/lib.macosx-10.3-fat-2.6/reportlab/lib/hyphen.mashed -> / Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site- packages/reportlab/lib running install_egg_info Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab-2.3-py2.6.egg-info Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab-2.3-py2.6.egg-info ########## SUMMARY INFO ######### ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/Users/kiffer/Downloads/ReportLab_2_3/src/rl_addons/ renderPM' # installing with freetype version 21 ################################################ --- This looks good. But when I run "python setup.py tests" I get: --- christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ python setup.py tests ..............................................................................................................EE ........E ........................................................................ ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_callback.py", line 24, in test0 makeDocument(outputfile('test_pdfgen_callback.pdf'), pageCallBack=self.callMe) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 909, in test0 run(outputfile('test_pdfgen_general.pdf')) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 872, in run c = makeDocument(filename) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a platypus document ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 567, in test0 run() File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 559, in run doc.build(commentary,examples) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 546, in build self.fillFrame(flowables2) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 537, in fillFrame self.handle_flowable(flowables) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/doctemplate.py", line 665, in handle_flowable if frame.add(f, canv, trySplit=self.allowSplitting): File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/frames.py", line 174, in _add flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 105, in drawOn self._drawOn(canvas) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 89, in _drawOn self.draw()#this is the bit you overload File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 396, in draw mask=self._mask, File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 673, in drawImage rawdata = image.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ---------------------------------------------------------------------- Ran 193 tests in 62.051s FAILED (errors=3) --------- What more do I need to do? I am afraid I do not know how to read these error messages. Thanks, Christopher On 6 Aug 2009, at 11:28, Robin Becker wrote: Christopher Brewster wrote: > On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. > When I run "python setup.py install" I get the following: > --- ........... > This appears to be good but when I run "python setup.py tests" I get > the messages below. > Is there anything I have done wrong or what? > Thanks for your advice. > Christopher Could this be a line ending conversion error. We don't make MAC specific archives. I always assumed that people used the tar.gz files and that being some kind of unix the mac versions just worked like unix. the import and PIL errors are reminiscent of problem we get when line endings are converted wrongly. ........ -- Robin Becker _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From robin at reportlab.com Thu Aug 6 08:49:40 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 06 Aug 2009 13:49:40 +0100 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> Message-ID: <4A7AD164.7040402@chamonix.reportlab.co.uk> Christopher Brewster wrote: > This certainly helped a lot but I am not sure it worked entirely. > Running "sudo python setup.py install" I get: ....... the errors you're reporting appear to be related to PIL. The error related to tgif may be occurring because we are trying to test that a jpg that is copied to a file ending in '.gif' is actually recognised properly so we need to carry out the copy. Doing the install as su probably requires that you run the tests as su. -- Robin Becker From cbrewster at gmail.com Thu Aug 6 11:47:01 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 17:47:01 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <4A7AD164.7040402@chamonix.reportlab.co.uk> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> <4A7AD164.7040402@chamonix.reportlab.co.uk> Message-ID: I ran the test as su and got the same result. Based on your message I thought there might be a problem with PIL and so I reinstalled it and ran the tests it has to see if it works. That went fine When I returned to reportlab, I still have the same problems running the test: FAILED(errors=3: Any thoughts? Thank you for your help so far. Christopher ---- christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ sudo python setup.py tests ..............................................................................................................EE ........E ........................................................................ ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_callback.py", line 24, in test0 makeDocument(outputfile('test_pdfgen_callback.pdf'), pageCallBack=self.callMe) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a PDFgen document with most graphics features ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 909, in test0 run(outputfile('test_pdfgen_general.pdf')) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 872, in run c = makeDocument(filename) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_pdfgen_general.py", line 748, in makeDocument c.drawImage(tgif, 4*inch, 9.25*inch, w, h, mask='auto') File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 690, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2040, in __init__ self.loadImageFromA85(src) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfdoc.py", line 2044, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfbase/pdfutils.py", line 34, in makeA85Image raw = img.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ====================================================================== ERROR: Make a platypus document ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 567, in test0 run() File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 559, in run doc.build(commentary,examples) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 546, in build self.fillFrame(flowables2) File "/Users/kiffer/Downloads/ReportLab_2_3/tests/ test_platypus_general.py", line 537, in fillFrame self.handle_flowable(flowables) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/doctemplate.py", line 665, in handle_flowable if frame.add(f, canv, trySplit=self.allowSplitting): File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/frames.py", line 174, in _add flowable.drawOn(canv, self._x + self._leftExtraIndent, y, _sW=aW-w) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 105, in drawOn self._drawOn(canvas) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 89, in _drawOn self.draw()#this is the bit you overload File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/platypus/flowables.py", line 396, in draw mask=self._mask, File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/pdfgen/canvas.py", line 673, in drawImage rawdata = image.getRGBData() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/reportlab/lib/utils.py", line 657, in getRGBData self._data = im.tostring() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/Image.py", line 513, in tostring self.load() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/ImageFile.py", line 207, in load raise IOError(error + " when reading image file") IOError: decoding error when reading image file ---------------------------------------------------------------------- Ran 193 tests in 69.220s FAILED (errors=3) ---- On 6 Aug 2009, at 14:49, Robin Becker wrote: Christopher Brewster wrote: > This certainly helped a lot but I am not sure it worked entirely. > Running "sudo python setup.py install" I get: ....... the errors you're reporting appear to be related to PIL. The error related to tgif may be occurring because we are trying to test that a jpg that is copied to a file ending in '.gif' is actually recognised properly so we need to carry out the copy. Doing the install as su probably requires that you run the tests as su. -- Robin Becker _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From janssen at parc.com Thu Aug 6 12:00:50 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:00:50 PDT Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <4A7AA225.9070706@chamonix.reportlab.co.uk> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> Message-ID: <81501.1249574450@parc.com> Robin Becker wrote: > Christopher Brewster wrote: > > On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. > > When I run "python setup.py install" I get the following: > > --- > ........... > > This appears to be good but when I run "python setup.py tests" I get > > the messages below. > > Is there anything I have done wrong or what? > > > > Thanks for your advice. > > > > Christopher > > > Could this be a line ending conversion error. We don't make MAC > specific archives. I always assumed that people used the tar.gz files > and that being some kind of unix the mac versions just worked like > unix. the import and PIL errors are reminiscent of problem we get when > line endings are converted wrongly. Doubt it. I build ReportLab from source on my Mac pretty much every day -- as you say, it's pretty much UNIX. Note that the OP is using some other flavor of Python -- it's 2.6, and 2.5 is what OS X 10.5 comes with. Looks like a third-party Python, not the one that ships with the Mac. Maybe it's built wrong. Bill From cbrewster at gmail.com Thu Aug 6 12:05:42 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:05:42 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <81501.1249574450@parc.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <81501.1249574450@parc.com> Message-ID: It is 2.6 downloaded from Python.org I thought that is what one is supposed to do (use the latest version ....) There does seem to be a problem with PIL and 2.6 though. I am about to query the Image-SIG. Christopher On 6 Aug 2009, at 18:00, Bill Janssen wrote: Robin Becker wrote: > Christopher Brewster wrote: >> On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. >> When I run "python setup.py install" I get the following: >> --- > ........... >> This appears to be good but when I run "python setup.py tests" I get >> the messages below. >> Is there anything I have done wrong or what? >> >> Thanks for your advice. >> >> Christopher >> > Could this be a line ending conversion error. We don't make MAC > specific archives. I always assumed that people used the tar.gz files > and that being some kind of unix the mac versions just worked like > unix. the import and PIL errors are reminiscent of problem we get when > line endings are converted wrongly. Doubt it. I build ReportLab from source on my Mac pretty much every day -- as you say, it's pretty much UNIX. Note that the OP is using some other flavor of Python -- it's 2.6, and 2.5 is what OS X 10.5 comes with. Looks like a third-party Python, not the one that ships with the Mac. Maybe it's built wrong. Bill _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From janssen at parc.com Thu Aug 6 12:07:42 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:07:42 PDT Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> <4A7AD164.7040402@chamonix.reportlab.co.uk> Message-ID: <81554.1249574862@parc.com> Christopher, can you show us the output from building and installing PIL? What you want to look for is this: -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- I build PIL and ReportLab continuously on an OS X 10.5 buildbot. To get all of these libraries supported by PIL, I also have to build and install libpng, libjpeg, libtiff, and freetype2 before I build PIL. Bill From johnkeyes at gmail.com Thu Aug 6 12:12:13 2009 From: johnkeyes at gmail.com (John Keyes) Date: Thu, 6 Aug 2009 17:12:13 +0100 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <81501.1249574450@parc.com> Message-ID: <21aa4c930908060912pef6a3aclad76a50c9621ab73@mail.gmail.com> I use 2.6.2 and PIL 1.6.1 and ReportLab on OS X 10.5.5 and haven't come across the above. -John K On Thu, Aug 6, 2009 at 5:05 PM, Christopher Brewster wrote: > It is 2.6 downloaded from Python.org > I thought that is what one is supposed to do (use the latest version ....) > > There does seem to be a problem with PIL and 2.6 though. I am about to query > the Image-SIG. > > Christopher > > > On 6 Aug 2009, at 18:00, Bill Janssen wrote: > > Robin Becker wrote: > >> Christopher Brewster wrote: >>> >>> On a Macbook Pro running Leopard, I have PIL and Freetype2 installed. >>> When I run "python setup.py install" I get the following: >>> --- >> >> ........... >>> >>> This appears to be good but when I run "python setup.py tests" I get >>> the messages below. >>> Is there anything I have done wrong or what? >>> >>> Thanks for your advice. >>> >>> Christopher >>> >> Could this be a line ending conversion error. We don't make MAC >> specific archives. I always assumed that people used the tar.gz files >> and that being some kind of unix the mac versions just worked like >> unix. the import and PIL errors are reminiscent of problem we get when >> line endings are converted wrongly. > > Doubt it. ?I build ReportLab from source on my Mac pretty much every day > -- as you say, it's pretty much UNIX. > > Note that the OP is using some other flavor of Python -- it's 2.6, and > 2.5 is what OS X 10.5 comes with. ?Looks like a third-party Python, not > the one that ships with the Mac. ?Maybe it's built wrong. > > Bill > _______________________________________________ > 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 > -- me: http://www.keyes.ie/ charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie From cbrewster at gmail.com Thu Aug 6 12:21:00 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:21:00 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <81554.1249574862@parc.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> <4A7AD164.7040402@chamonix.reportlab.co.uk> <81554.1249574862@parc.com> Message-ID: <92D9D890-4FDB-46C0-8EAA-DBBDBE91A1C3@gmail.com> Bill, Here is the PIL installation output from a an hour or so ago: - -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- To check the build, run the selftest.py script. running build_scripts running install_lib running install_scripts changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/ pilconvert.py to 755 changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/ pildriver.py to 755 changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/ pilfile.py to 755 changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/ pilfont.py to 755 changing mode of /Library/Frameworks/Python.framework/Versions/2.6/bin/ pilprint.py to 755 running install_egg_info Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info creating /Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/PIL.pth christopher-brewsters-macbook-pro-15:Imaging-1.1.6 kiffer$ sudo python selftest.py 57 tests passed. ---- Does this help to identify the problem? I am convinced it has something to do with 2.6 vs. 2.5 from what i am reading on the net. Christopher On 6 Aug 2009, at 18:07, Bill Janssen wrote: Christopher, can you show us the output from building and installing PIL? What you want to look for is this: -------------------------------------------------------------------- PIL 1.1.6 BUILD SUMMARY -------------------------------------------------------------------- version 1.1.6 platform darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) [GCC 4.0.1 (Apple Inc. build 5465)] -------------------------------------------------------------------- --- TKINTER support ok --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok -------------------------------------------------------------------- I build PIL and ReportLab continuously on an OS X 10.5 buildbot. To get all of these libraries supported by PIL, I also have to build and install libpng, libjpeg, libtiff, and freetype2 before I build PIL. Bill _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From janssen at parc.com Thu Aug 6 12:20:52 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:20:52 PDT Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <81501.1249574450@parc.com> Message-ID: <82593.1249575652@parc.com> Christopher Brewster wrote: > It is 2.6 downloaded from Python.org > I thought that is what one is supposed to do (use the latest version > ....) My experience with Python on Macs is that it's almost always trouble to install a different version of Python than the system comes with. You can do it if you know what happens, but otherwise strange and mystifying things will happen to your system (my systems, at any rate). Bill From cbrewster at gmail.com Thu Aug 6 12:24:31 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:24:31 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <82593.1249575652@parc.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <81501.1249574450@parc.com> <82593.1249575652@parc.com> Message-ID: <5745CBDA-E2FC-4A26-A3C3-48A8352D3720@gmail.com> Is there a coherent way to revert to the system installed version? Christopher On 6 Aug 2009, at 18:20, Bill Janssen wrote: Christopher Brewster wrote: > It is 2.6 downloaded from Python.org > I thought that is what one is supposed to do (use the latest version > ....) My experience with Python on Macs is that it's almost always trouble to install a different version of Python than the system comes with. You can do it if you know what happens, but otherwise strange and mystifying things will happen to your system (my systems, at any rate). Bill _______________________________________________ reportlab-users mailing list reportlab-users at reportlab.com http://two.pairlist.net/mailman/listinfo/reportlab-users From janssen at parc.com Thu Aug 6 12:27:24 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:27:24 PDT Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <92D9D890-4FDB-46C0-8EAA-DBBDBE91A1C3@gmail.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> <4A7AD164.7040402@chamonix.reportlab.co.uk> <81554.1249574862@parc.com> <92D9D890-4FDB-46C0-8EAA-DBBDBE91A1C3@gmail.com> Message-ID: <83739.1249576044@parc.com> Christopher, Nope, that looks good to me. But from the note you posted to Image-SIG, I'll bet you're dynamically linked against the wrong version of libjpeg. Bill Christopher Brewster wrote: > Bill, > > Here is the PIL installation output from a an hour or so ago: > > - > > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform darwin 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] > -------------------------------------------------------------------- > --- TKINTER support ok > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > To check the build, run the selftest.py script. > running build_scripts > running install_lib > running install_scripts > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilconvert.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pildriver.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilfile.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilfont.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilprint.py to 755 > running install_egg_info > Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info > Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info > creating /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL.pth > christopher-brewsters-macbook-pro-15:Imaging-1.1.6 kiffer$ sudo python > selftest.py > 57 tests passed. > > ---- > > Does this help to identify the problem? > I am convinced it has something to do with 2.6 vs. 2.5 from what i am > reading on the net. > > Christopher > > > > On 6 Aug 2009, at 18:07, Bill Janssen wrote: > > Christopher, can you show us the output from building and installing > PIL? > > What you want to look for is this: > > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) > [GCC 4.0.1 (Apple Inc. build 5465)] > -------------------------------------------------------------------- > --- TKINTER support ok > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > > I build PIL and ReportLab continuously on an OS X 10.5 buildbot. To > get all of these libraries supported by PIL, I also have to build and > install libpng, libjpeg, libtiff, and freetype2 before I build PIL. > > Bill > _______________________________________________ > 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 cbrewster at gmail.com Thu Aug 6 12:33:39 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:33:39 +0200 Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <83739.1249576044@parc.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <03E6505D-729E-4A29-8EEC-FFAEB568C207@gmail.com> <4A7AD164.7040402@chamonix.reportlab.co.uk> <81554.1249574862@parc.com> <92D9D890-4FDB-46C0-8EAA-DBBDBE91A1C3@gmail.com> <83739.1249576044@parc.com> Message-ID: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> Yes so it appears. I have a collection of libjpeg libraries on my machine (heaven know how or why). See below. How do I remove the wrong one or make it inaccessible? Is it just the path in .bash_profile or something else I need to do? Thanks (apologies for my ignorance) Christopher On 6 Aug 2009, at 18:27, Bill Janssen wrote: Christopher, Nope, that looks good to me. But from the note you posted to Image-SIG, I'll bet you're dynamically linked against the wrong version of libjpeg. Bill Christopher Brewster wrote: > Bill, > > Here is the PIL installation output from a an hour or so ago: > > - > > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform darwin 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] > -------------------------------------------------------------------- > --- TKINTER support ok > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > To check the build, run the selftest.py script. > running build_scripts > running install_lib > running install_scripts > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilconvert.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pildriver.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilfile.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilfont.py to 755 > changing mode of > /Library/Frameworks/Python.framework/Versions/2.6/bin/ > pilprint.py to 755 > running install_egg_info > Removing /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info > Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL/PIL-1.1.6-py2.6.egg-info > creating /Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/site-packages/PIL.pth > christopher-brewsters-macbook-pro-15:Imaging-1.1.6 kiffer$ sudo python > selftest.py > 57 tests passed. > > ---- > > Does this help to identify the problem? > I am convinced it has something to do with 2.6 vs. 2.5 from what i am > reading on the net. > > Christopher > > > > On 6 Aug 2009, at 18:07, Bill Janssen wrote: > > Christopher, can you show us the output from building and installing > PIL? > > What you want to look for is this: > > -------------------------------------------------------------------- > PIL 1.1.6 BUILD SUMMARY > -------------------------------------------------------------------- > version 1.1.6 > platform darwin 2.5.1 (r251:54863, Jan 13 2009, 10:26:13) > [GCC 4.0.1 (Apple Inc. build 5465)] > -------------------------------------------------------------------- > --- TKINTER support ok > --- JPEG support ok > --- ZLIB (PNG/ZIP) support ok > --- FREETYPE2 support ok > -------------------------------------------------------------------- > > I build PIL and ReportLab continuously on an OS X 10.5 buildbot. To > get all of these libraries supported by PIL, I also have to build and > install libpng, libjpeg, libtiff, and freetype2 before I build PIL. > > Bill > _______________________________________________ > 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 Aug 6 12:34:00 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 09:34:00 PDT Subject: [reportlab-users] Problems installing Reportlab In-Reply-To: <82593.1249575652@parc.com> References: <2D256386-95F9-4DF8-AE4F-5E5C020BB4C0@gmail.com> <4A7AA225.9070706@chamonix.reportlab.co.uk> <81501.1249574450@parc.com> <82593.1249575652@parc.com> Message-ID: <84119.1249576440@parc.com> Bill Janssen wrote: > Christopher Brewster wrote: > > > It is 2.6 downloaded from Python.org > > I thought that is what one is supposed to do (use the latest version > > ....) > > My experience with Python on Macs is that it's almost always trouble to > install a different version of Python than the system comes with. You > can do it if you know what happens, but otherwise strange and mystifying > things will happen to your system (my systems, at any rate). By the way, I build and install various Pythons (2.6, 2.7, 3.1) from source on my Mac all the time, too, without any trouble. The trick is to use --disable-framework --disable-toolbox-glue, so that the install scripts don't try to mess with your system. If you're not developing Cocoa apps with Python, that will work fine for you. Unfortunately, the standard MacPython installer from python.org is a mongo installer that tries to do everything. And it does pretty well, but unfortunately the Apple defaults for some things like linker search order interact with it badly. Bill From cbrewster at gmail.com Thu Aug 6 12:50:49 2009 From: cbrewster at gmail.com (Christopher Brewster) Date: Thu, 6 Aug 2009 18:50:49 +0200 Subject: [reportlab-users] Fwd: Problems installing Reportlab References: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> Message-ID: [I forgot to include the output from my system] Yes so it appears. I have a collection of libjpeg libraries on my machine (heaven know how or why). See below. How do I remove the wrong one or make it inaccessible? Is it just the path in .bash_profile or something else I need to do? Thanks (apologies for my ignorance) Christopher -------- christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ locate libjpeg /Library/Frameworks/UnixImageIO.framework/Versions/B/unix/lib/ libjpeg.dylib /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/ libjpeg.jnilib /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/ libjpeg.jnilib /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ libjpeg.jnilib /System/Library/Tcl/Img1.3/libjpegtcl1.0.dylib /opt/local/lib/libjpeg.62.0.0.dylib /opt/local/lib/libjpeg.62.dylib /opt/local/lib/libjpeg.a /opt/local/lib/libjpeg.dylib /opt/local/lib/libjpeg.la /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. 62.0.0.dylib /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. 62.dylib /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.a /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.dylib /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.la /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.info /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.patch /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.info /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.patch /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.info /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.patch /usr/local/lib/libjpeg.7.dylib /usr/local/lib/libjpeg.a /usr/local/lib/libjpeg.dylib /usr/local/lib/libjpeg.la From janssen at parc.com Thu Aug 6 13:51:37 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 10:51:37 PDT Subject: [reportlab-users] Fwd: Problems installing Reportlab In-Reply-To: References: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> Message-ID: <85412.1249581097@parc.com> Wow, you've really junked up your machine. I'd start by deleting everything under /sw, /opt/local/, and /usr/local -- but that's just me. I've had really bad luck with Fink (/sw/*), which is where your "bad" jpeg library lives. Personally, I did "rm -rf /sw" on my machines years ago; life is much easier since I did that. MacPorts seems better, though I don't trust it either, probably because of my experience with Fink. So, for you, I'd recommend getting rid of Fink (/sw), and seeing if that fixes things. I hope there are no Fink packages you need... Bill Christopher Brewster wrote: > [I forgot to include the output from my system] > > Yes so it appears. > I have a collection of libjpeg libraries on my machine (heaven know > how or why). See below. > How do I remove the wrong one or make it inaccessible? > Is it just the path in .bash_profile or something else I need to do? > > Thanks (apologies for my ignorance) > > Christopher > > -------- > christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ locate > libjpeg > /Library/Frameworks/UnixImageIO.framework/Versions/B/unix/lib/ > libjpeg.dylib > /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/ > libjpeg.jnilib > /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/ > libjpeg.jnilib > /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ > libjpeg.jnilib > /System/Library/Tcl/Img1.3/libjpegtcl1.0.dylib > /opt/local/lib/libjpeg.62.0.0.dylib > /opt/local/lib/libjpeg.62.dylib > /opt/local/lib/libjpeg.a > /opt/local/lib/libjpeg.dylib > /opt/local/lib/libjpeg.la > /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. > 62.0.0.dylib > /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. > 62.dylib > /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.a > /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.dylib > /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.la > /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.info > /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.patch > /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.info > /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.patch > /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.info > /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.patch > /usr/local/lib/libjpeg.7.dylib > /usr/local/lib/libjpeg.a > /usr/local/lib/libjpeg.dylib > /usr/local/lib/libjpeg.la > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From johnkeyes at gmail.com Thu Aug 6 13:55:04 2009 From: johnkeyes at gmail.com (John Keyes) Date: Thu, 6 Aug 2009 18:55:04 +0100 Subject: [reportlab-users] Fwd: Problems installing Reportlab In-Reply-To: <85412.1249581097@parc.com> References: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> <85412.1249581097@parc.com> Message-ID: <21aa4c930908061055p485d4afaid09b85b42d560ca0@mail.gmail.com> I install all my libs from source into /usr/local and it works fine. I think the key is to follow one approach and stick with it. Mixing and matching can lead to inconsistent results. -John K On Thu, Aug 6, 2009 at 6:51 PM, Bill Janssen wrote: > Wow, you've really junked up your machine. ?I'd start by deleting > everything under /sw, /opt/local/, and /usr/local -- but that's just > me. > > I've had really bad luck with Fink (/sw/*), which is where your "bad" > jpeg library lives. ?Personally, I did "rm -rf /sw" on my machines years > ago; life is much easier since I did that. ?MacPorts seems better, > though I don't trust it either, probably because of my experience with > Fink. > > So, for you, I'd recommend getting rid of Fink (/sw), and seeing if > that fixes things. ?I hope there are no Fink packages you need... > > Bill > > > Christopher Brewster wrote: > >> ?[I forgot to include the output from my system] >> >> Yes so it appears. >> I have a collection of libjpeg libraries on my machine (heaven know >> how or why). See below. >> How do I remove the wrong one or make it inaccessible? >> Is it just the path in .bash_profile or something else I need to do? >> >> Thanks (apologies for my ignorance) >> >> Christopher >> >> -------- >> christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ locate >> libjpeg >> /Library/Frameworks/UnixImageIO.framework/Versions/B/unix/lib/ >> libjpeg.dylib >> /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/ >> libjpeg.jnilib >> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/ >> libjpeg.jnilib >> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ >> libjpeg.jnilib >> /System/Library/Tcl/Img1.3/libjpegtcl1.0.dylib >> /opt/local/lib/libjpeg.62.0.0.dylib >> /opt/local/lib/libjpeg.62.dylib >> /opt/local/lib/libjpeg.a >> /opt/local/lib/libjpeg.dylib >> /opt/local/lib/libjpeg.la >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. >> 62.0.0.dylib >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. >> 62.dylib >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.a >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.dylib >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.la >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.info >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.patch >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.info >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.patch >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.info >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.patch >> /usr/local/lib/libjpeg.7.dylib >> /usr/local/lib/libjpeg.a >> /usr/local/lib/libjpeg.dylib >> /usr/local/lib/libjpeg.la >> >> _______________________________________________ >> 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 > -- me: http://www.keyes.ie/ charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie From janssen at parc.com Thu Aug 6 14:08:31 2009 From: janssen at parc.com (Bill Janssen) Date: Thu, 6 Aug 2009 11:08:31 PDT Subject: [reportlab-users] Fwd: Problems installing Reportlab In-Reply-To: <21aa4c930908061055p485d4afaid09b85b42d560ca0@mail.gmail.com> References: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> <85412.1249581097@parc.com> <21aa4c930908061055p485d4afaid09b85b42d560ca0@mail.gmail.com> Message-ID: <86216.1249582111@parc.com> Yep, I agree. I install under /local, because apparently /usr/* can be overwritten by upgrades. Bill John Keyes wrote: > I install all my libs from source into /usr/local and it works fine. > I think the key is to follow one approach and stick with it. Mixing > and matching can lead to inconsistent results. > > -John K > > On Thu, Aug 6, 2009 at 6:51 PM, Bill Janssen wrote: > > Wow, you've really junked up your machine. ?I'd start by deleting > > everything under /sw, /opt/local/, and /usr/local -- but that's just > > me. > > > > I've had really bad luck with Fink (/sw/*), which is where your "bad" > > jpeg library lives. ?Personally, I did "rm -rf /sw" on my machines years > > ago; life is much easier since I did that. ?MacPorts seems better, > > though I don't trust it either, probably because of my experience with > > Fink. > > > > So, for you, I'd recommend getting rid of Fink (/sw), and seeing if > > that fixes things. ?I hope there are no Fink packages you need... > > > > Bill > > > > > > Christopher Brewster wrote: > > > >> ?[I forgot to include the output from my system] > >> > >> Yes so it appears. > >> I have a collection of libjpeg libraries on my machine (heaven know > >> how or why). See below. > >> How do I remove the wrong one or make it inaccessible? > >> Is it just the path in .bash_profile or something else I need to do? > >> > >> Thanks (apologies for my ignorance) > >> > >> Christopher > >> > >> -------- > >> christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ locate > >> libjpeg > >> /Library/Frameworks/UnixImageIO.framework/Versions/B/unix/lib/ > >> libjpeg.dylib > >> /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/ > >> libjpeg.jnilib > >> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/ > >> libjpeg.jnilib > >> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ > >> libjpeg.jnilib > >> /System/Library/Tcl/Img1.3/libjpegtcl1.0.dylib > >> /opt/local/lib/libjpeg.62.0.0.dylib > >> /opt/local/lib/libjpeg.62.dylib > >> /opt/local/lib/libjpeg.a > >> /opt/local/lib/libjpeg.dylib > >> /opt/local/lib/libjpeg.la > >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. > >> 62.0.0.dylib > >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. > >> 62.dylib > >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.a > >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.dylib > >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.la > >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.info > >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.patch > >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.info > >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.patch > >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.info > >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.patch > >> /usr/local/lib/libjpeg.7.dylib > >> /usr/local/lib/libjpeg.a > >> /usr/local/lib/libjpeg.dylib > >> /usr/local/lib/libjpeg.la > >> > >> _______________________________________________ > >> 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 > > > > > > -- > me: http://www.keyes.ie/ > > charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From johnkeyes at gmail.com Thu Aug 6 15:41:31 2009 From: johnkeyes at gmail.com (John Keyes) Date: Thu, 6 Aug 2009 20:41:31 +0100 Subject: [reportlab-users] Fwd: Problems installing Reportlab In-Reply-To: <86216.1249582111@parc.com> References: <02FEA9F8-3934-4B8C-9AEE-0D8EB5BA2B3A@gmail.com> <85412.1249581097@parc.com> <21aa4c930908061055p485d4afaid09b85b42d560ca0@mail.gmail.com> <86216.1249582111@parc.com> Message-ID: <21aa4c930908061241w6404a3fbif8a21cad5e6502cf@mail.gmail.com> Ah I didn't know that. Next time I'm rebuilding I'll keep that in mind. -John K On Thu, Aug 6, 2009 at 7:08 PM, Bill Janssen wrote: > Yep, I agree. ?I install under /local, because apparently /usr/* can be > overwritten by upgrades. > > Bill > > John Keyes wrote: > >> I install all my libs from source into /usr/local and it works fine. >> I think the key is to follow one approach and stick with it. Mixing >> and matching can lead to inconsistent results. >> >> -John K >> >> On Thu, Aug 6, 2009 at 6:51 PM, Bill Janssen wrote: >> > Wow, you've really junked up your machine. ?I'd start by deleting >> > everything under /sw, /opt/local/, and /usr/local -- but that's just >> > me. >> > >> > I've had really bad luck with Fink (/sw/*), which is where your "bad" >> > jpeg library lives. ?Personally, I did "rm -rf /sw" on my machines years >> > ago; life is much easier since I did that. ?MacPorts seems better, >> > though I don't trust it either, probably because of my experience with >> > Fink. >> > >> > So, for you, I'd recommend getting rid of Fink (/sw), and seeing if >> > that fixes things. ?I hope there are no Fink packages you need... >> > >> > Bill >> > >> > >> > Christopher Brewster wrote: >> > >> >> ?[I forgot to include the output from my system] >> >> >> >> Yes so it appears. >> >> I have a collection of libjpeg libraries on my machine (heaven know >> >> how or why). See below. >> >> How do I remove the wrong one or make it inaccessible? >> >> Is it just the path in .bash_profile or something else I need to do? >> >> >> >> Thanks (apologies for my ignorance) >> >> >> >> Christopher >> >> >> >> -------- >> >> christopher-brewsters-macbook-pro-15:ReportLab_2_3 kiffer$ locate >> >> libjpeg >> >> /Library/Frameworks/UnixImageIO.framework/Versions/B/unix/lib/ >> >> libjpeg.dylib >> >> /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/ >> >> libjpeg.jnilib >> >> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/ >> >> libjpeg.jnilib >> >> /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/ >> >> libjpeg.jnilib >> >> /System/Library/Tcl/Img1.3/libjpegtcl1.0.dylib >> >> /opt/local/lib/libjpeg.62.0.0.dylib >> >> /opt/local/lib/libjpeg.62.dylib >> >> /opt/local/lib/libjpeg.a >> >> /opt/local/lib/libjpeg.dylib >> >> /opt/local/lib/libjpeg.la >> >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. >> >> 62.0.0.dylib >> >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg. >> >> 62.dylib >> >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.a >> >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.dylib >> >> /opt/local/var/macports/software/jpeg/6b_2/opt/local/lib/libjpeg.la >> >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.info >> >> /sw/fink/10.4/stable/main/finkinfo/graphics/libjpeg.patch >> >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.info >> >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg-exif.patch >> >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.info >> >> /sw/fink/10.4/unstable/main/finkinfo/graphics/libjpeg.patch >> >> /usr/local/lib/libjpeg.7.dylib >> >> /usr/local/lib/libjpeg.a >> >> /usr/local/lib/libjpeg.dylib >> >> /usr/local/lib/libjpeg.la >> >> >> >> _______________________________________________ >> >> 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 >> > >> >> >> >> -- >> me: http://www.keyes.ie/ >> >> charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie >> _______________________________________________ >> 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 > -- me: http://www.keyes.ie/ charities: http://www.oxfam.ie | http://www.bothar.org | http://www.ipcc.ie From stephan0h at gmx.net Fri Aug 7 08:01:38 2009 From: stephan0h at gmx.net (stephan0h at gmx.net) Date: Fri, 07 Aug 2009 14:01:38 +0200 Subject: [reportlab-users] Memory Error Message-ID: <4A7C17A2.9050600@gmx.net> Hi Group, I've got an memory error: File "/usr/lib/python2.6/dist-packages/reportlab/pdfgen/canvas.py", line 947, in save self._doc.SaveToFile(self._filename, self) File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 223, in SaveToFile f.write(self.GetPDFData(canvas)) File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 245, in GetPDFData return self.format() File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 388, in format IOf = IO.format(self) File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 837, in format fcontent = format(content, document, toplevel=1) # yes this is at top level File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 98, in format f = element.format(document) File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 763, in format content = f.encode(content) File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", line 716, in encode text = _AsciiBase85Encode(text) MemoryError I use Reportlab to create a kind of photo album. The one I tried to create is about 100 pages, the images are 300 dpi. Any ideas? thanks, stephan From paul.barrass at safeonlinebilling.com Fri Aug 7 08:09:32 2009 From: paul.barrass at safeonlinebilling.com (Paul Barrass) Date: Fri, 07 Aug 2009 13:09:32 +0100 Subject: [reportlab-users] Memory Error In-Reply-To: <4A7C17A2.9050600@gmx.net> References: <4A7C17A2.9050600@gmx.net> Message-ID: <4A7C197C.1020400@safeonlinebilling.com> stephan0h at gmx.net wrote: > Hi Group, > > I've got an memory error: > content = f.encode(content) > File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", > line 716, in encode > text = _AsciiBase85Encode(text) > MemoryError > > I use Reportlab to create a kind of photo album. The one I tried to > create is about 100 pages, the images are 300 dpi. > > Any ideas? > How much memory are you trying to use, and how much do you actually have? top would answer both of these questions whilst running the script. What format are the images in, and how well are they compressed? Paul Barrass. From gherman at darwin.in-berlin.de Fri Aug 7 10:48:09 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 7 Aug 2009 16:48:09 +0200 Subject: [reportlab-users] Further AreaLinePlot bugs Message-ID: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> Hi, I think I've found another bug in the AreaLinePlot chart. In the attached example I'm unable to find a reason for having more tick marks and labels on the x-axis (7) than slots per "row" in the data (4). I'd be very happy for someone able to explain this behaviour to me. See attached code for further analysis, producing the same bug for RL 2.2 and 2.3. Also, it seems that AreaLinePlots require their category axis to be a ValueAxis (doing mysterious calculations) instead of a Cate- goryAxis which would also allow simple strings and which would be also perfectly ok for the general case. The current implemen- tation seems to accept only numerical values which seems to me like an unnecessary restriction. Apart from this I'd like to know how the other bugs I reported for AreaLinePlot are being handled? Regards, Dinu -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arealineplot.pdf Type: application/pdf Size: 5180 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: test_arealineplot.py Type: text/x-python-script Size: 3197 bytes Desc: not available Url : -------------- next part -------------- ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From gherman at darwin.in-berlin.de Fri Aug 7 10:55:21 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 7 Aug 2009 16:55:21 +0200 Subject: [reportlab-users] Further AreaLinePlot bugs In-Reply-To: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> References: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> Message-ID: I wrote: > I think I've found another bug in the AreaLinePlot chart. In the > attached example I'm unable to find a reason for having more tick > marks and labels on the x-axis (7) than slots per "row" in the > data (4). > > I'd be very happy for someone able to explain this behaviour to > me. See attached code for further analysis, producing the same > bug for RL 2.2 and 2.3. > > Also, it seems that AreaLinePlots require their category axis to > be a ValueAxis (doing mysterious calculations) instead of a Cate- > goryAxis which would also allow simple strings and which would > be also perfectly ok for the general case. The current implemen- > tation seems to accept only numerical values which seems to me > like an unnecessary restriction. Well, if the AreaLinePlot's x-axis is a ValueAxis the additional ticks make some sense, but for a AreaLinePlot they actually don't have to make sense because there can be cases where there should not be any additional ticks, at least not in my case, in which I'd like to suppress such additional ticks... I wish there'd be a setting for this or even better, a version of AreaLinePlot based on a CategoryAxis as well... Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From stephan0h at gmx.net Fri Aug 7 11:20:58 2009 From: stephan0h at gmx.net (stephan0h at gmx.net) Date: Fri, 07 Aug 2009 17:20:58 +0200 Subject: [reportlab-users] reportlab-users Digest, Vol 63, Issue 10 In-Reply-To: <4A7C458D.3020909@gmx.net> References: <4A7C458D.3020909@gmx.net> Message-ID: <4A7C465A.6080705@gmx.net> > Message: 4 > Date: Fri, 07 Aug 2009 13:09:32 +0100 > From: Paul Barrass > Subject: Re: [reportlab-users] Memory Error > To: Support list for users of Reportlab software > > Message-ID: <4A7C197C.1020400 at safeonlinebilling.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > stephan0h at gmx.net wrote: >> Hi Group, >> >> I've got an memory error: >> content = f.encode(content) >> File "/usr/lib/python2.6/dist-packages/reportlab/pdfbase/pdfdoc.py", >> line 716, in encode >> text = _AsciiBase85Encode(text) >> MemoryError >> >> I use Reportlab to create a kind of photo album. The one I tried to >> create is about 100 pages, the images are 300 dpi. >> >> Any ideas? >> > How much memory are you trying to use, and how much do you actually > have? top would answer both of these questions whilst running the script. > > What format are the images in, and how well are they compressed? > > Paul Barrass. I watched the script: I've got 2 GB ram in my machine, this is used up, swapping begins. Then at some point I get this error. The images are jpegs. thanks, stephan From robin at reportlab.com Fri Aug 7 11:39:55 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 07 Aug 2009 16:39:55 +0100 Subject: [reportlab-users] Further AreaLinePlot bugs In-Reply-To: References: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> Message-ID: <4A7C4ACB.2090409@chamonix.reportlab.co.uk> Dinu Gherman wrote: > I wrote: > .......... > > Well, if the AreaLinePlot's x-axis is a ValueAxis the additional > ticks make some sense, but for a AreaLinePlot they actually don't > have to make sense because there can be cases where there should > not be any additional ticks, at least not in my case, in which > I'd like to suppress such additional ticks... > > I wish there'd be a setting for this or even better, a version > of AreaLinePlot based on a CategoryAxis as well... > > Dinu We have some category axis type charts in linecharts.py so perhaps they could be turned into area plots more easily than trying to force the issue the other way. In order to just get all the axis classes to be interchangeable we'd need a higher level definition of what plots are about. -- Robin Becker From andy at reportlab.com Sun Aug 9 07:05:05 2009 From: andy at reportlab.com (Andy Robinson) Date: Sun, 9 Aug 2009 12:05:05 +0100 Subject: [reportlab-users] Further AreaLinePlot bugs In-Reply-To: <4A7C4ACB.2090409@chamonix.reportlab.co.uk> References: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> <4A7C4ACB.2090409@chamonix.reportlab.co.uk> Message-ID: <956003ae0908090405q24519d2aja521c5a31352b1c1@mail.gmail.com> FYI, we're working on a substantial charting project for a client now (which is based on a fork of the code so no commits just yet), and they need area/line plots. There is some fundamental engineering being done first but we might be able to look at making axis-types more modular in September. > In order to just get all the axis classes to be interchangeable > we'd need a higher level definition of what plots are about. Exactly. I have not yet found a clean set of concepts to make a chart object hierarchy modular enough. Suggestions welcome. - Andy -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From gherman at darwin.in-berlin.de Tue Aug 11 04:38:16 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 11 Aug 2009 10:38:16 +0200 Subject: [reportlab-users] Further AreaLinePlot bugs In-Reply-To: <956003ae0908090405q24519d2aja521c5a31352b1c1@mail.gmail.com> References: <3C1C3EB6-EB68-46A8-BD13-18131225DC1E@darwin.in-berlin.de> <4A7C4ACB.2090409@chamonix.reportlab.co.uk> <956003ae0908090405q24519d2aja521c5a31352b1c1@mail.gmail.com> Message-ID: <35A568D0-607A-4F3D-AF32-F7D003B2D426@darwin.in-berlin.de> Andy Robinson: > FYI, we're working on a substantial charting project for a client now > (which is based on a fork of the code so no commits just yet), and > they need area/line plots. There is some fundamental engineering > being done first but we might be able to look at making axis-types > more modular in September. > >> In order to just get all the axis classes to be interchangeable >> we'd need a higher level definition of what plots are about. > Exactly. I have not yet found a clean set of concepts to > make a chart object hierarchy modular enough. Suggestions welcome. Looking at other libraries might help, see: http://wiki.python.org/moin/NumericAndScientific/Plotting Apart from that, I'd prefer a solution with minimal changes to existing code for my problem instead of using sth. totally new. In my case, and I believe in many others as well, it would be totally sufficient to simply display only ticks/labels on the axis for existing data points. It should be easy to make this an option in the ValueAxis, named "onlyDataPointTicks" or something like that. Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From suno.ano at sunoano.org Fri Aug 14 03:10:26 2009 From: suno.ano at sunoano.org (Suno Ano) Date: Fri, 14 Aug 2009 09:10:26 +0200 Subject: [reportlab-users] PostgreSQL, RML, Reportlab PDF generation Message-ID: <87zla2q3a5.fsf@wks.lan> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 834 bytes Desc: not available Url : From suno.ano at sunoano.org Fri Aug 14 04:57:53 2009 From: suno.ano at sunoano.org (Suno Ano) Date: Fri, 14 Aug 2009 10:57:53 +0200 Subject: [reportlab-users] IRC channel Message-ID: <87ocqipyb2.fsf@wks.lan> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 834 bytes Desc: not available Url : From robin at reportlab.com Fri Aug 14 05:57:02 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 14 Aug 2009 10:57:02 +0100 Subject: [reportlab-users] IRC channel In-Reply-To: <87ocqipyb2.fsf@wks.lan> References: <87ocqipyb2.fsf@wks.lan> Message-ID: <4A8534EE.8060607@chamonix.reportlab.co.uk> Suno Ano wrote: > I just checked; there does not seem an IRC channel with regards to > reportlab toolkit. Am I right? Imho there should be one. I used to use IRC back in the 90's. It seems a bit out of date these days. I think we were asked recently about twitter but I don't think there was a lot of enthusiasm for these new communications media from Andy who is probably the only person who counts. As for your earlier query re rml I don't actually know enough about z3c.rml to know if it satisfies your data source requirements or the split between data & layout. In our implementation we have dynamic features I think based on this eg other tags let you loop over the data line line.unitPrice line.qty etc etc etc -- Robin Becker From henning.vonbargen at arcor.de Sat Aug 15 08:02:18 2009 From: henning.vonbargen at arcor.de (Henning von Bargen) Date: Sat, 15 Aug 2009 14:02:18 +0200 Subject: [reportlab-users] reportlab-users Digest, Vol 62, Issue 16 In-Reply-To: References: Message-ID: <4A86A3CA.2050506@arcor.de> Hello reportlab users, FYI I have added experimental kerning support to the wordaxe hyphenation library (formerly deco-cow) available at http://deco-cow.sourceforge.net. To test it, please download the latest revision from the Subversion repository (see https://sourceforge.net/scm/?type=svn&group_id=105867). Kerning only works for TrueType fonts. For an example, I attached the output of the test_truetype.py script. Please note that kerning will probably slow down the PDF generation a little bit. Have fun! Henning -------------- next part -------------- A non-text attachment was scrubbed... Name: test_truetype.pdf Type: application/pdf Size: 35850 bytes Desc: not available Url : From ralsina at netmanagers.com.ar Sat Aug 15 11:02:08 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sat, 15 Aug 2009 12:02:08 -0300 Subject: [reportlab-users] reportlab-users Digest, Vol 62, Issue 16 In-Reply-To: <4A86A3CA.2050506@arcor.de> References: <4A86A3CA.2050506@arcor.de> Message-ID: <200908151202.08324.ralsina@netmanagers.com.ar> On Saturday 15 August 2009 09:02:18 Henning von Bargen wrote: > Hello reportlab users, > > FYI I have added experimental kerning support to the wordaxe hyphenation > library (formerly deco-cow) available at http://deco-cow.sourceforge.net. > > To test it, please download the latest revision from the Subversion > repository (see https://sourceforge.net/scm/?type=svn&group_id=105867). > > Kerning only works for TrueType fonts. > For an example, I attached the output of the test_truetype.py script. > > Please note that kerning will probably slow down the PDF generation a > little bit. > > Have fun! Cool! -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From kekko84 at gmail.com Sun Aug 16 04:40:15 2009 From: kekko84 at gmail.com (Francesco Argese) Date: Sun, 16 Aug 2009 10:40:15 +0200 Subject: [reportlab-users] [pyPdf] How to add a blank page in a pdf Message-ID: Hi all, I'm new to this list but I don't know if I'm in the right place to ask for some problems wit pyPdf. With a search with Google I have found some posts here regarding pyPdf but I'm not sure if this is the right list (isn't there an official one?). I want to add a blank page with pyPdf without having a pdf document with a blank page in it. Is it possible? Thanks in advance (excuse me if this isn't the right list) Francesco Argese -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Sun Aug 16 06:28:03 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Sun, 16 Aug 2009 12:28:03 +0200 Subject: [reportlab-users] [pyPdf] How to add a blank page in a pdf In-Reply-To: References: Message-ID: <2C6ADBA1-0396-413C-B3DE-8337B9E1098B@darwin.in-berlin.de> Francesco Argese: > I'm new to this list but I don't know if I'm in the right place to > ask for some problems wit pyPdf. > With a search with Google I have found some posts here regarding > pyPdf but I'm not sure if this is the right list (isn't there an > official one?). > I want to add a blank page with pyPdf without having a pdf document > with a blank page in it. Is it possible? Hi Francesco, yes, it is. Have a look at my pdfgrid tool which does something like this. Or even my pdfnup, which is more complex, though: http://pypi.python.org/pypi/pdfgrid http://pypi.python.org/pypi/pdfnup Hope that helps, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From robin at reportlab.com Tue Aug 18 09:37:18 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 18 Aug 2009 14:37:18 +0100 Subject: [reportlab-users] Transparency Message-ID: <4A8AAE8E.3020707@chamonix.reportlab.co.uk> Simon, I have now got round to using your patch and I think I have implemented it and a couple of other features (overprint & separations). This should be in the latest svn code. Not sure if these are working exactly as intended, but can you check the transparency support and see if it works for you? -- Robin Becker From simon.king at motorola.com Tue Aug 18 10:46:17 2009 From: simon.king at motorola.com (King Simon-NFHD78) Date: Tue, 18 Aug 2009 15:46:17 +0100 Subject: [reportlab-users] Transparency In-Reply-To: <4A8AAE8E.3020707@chamonix.reportlab.co.uk> References: <4A8AAE8E.3020707@chamonix.reportlab.co.uk> Message-ID: <8D20BBB55F590E42AADF592A815E86170449C537@zuk35exm65.ds.mot.com> > -----Original Message----- > From: Robin Becker [mailto:robin at reportlab.com] > Sent: 18 August 2009 14:37 > To: USERS REPORTLAB > Cc: King Simon-NFHD78 > Subject: Transparency > > Simon, > > I have now got round to using your patch and I think I have > implemented it and a > couple of other features (overprint & separations). This > should be in the latest > svn code. Not sure if these are working exactly as intended, > but can you check > the transparency support and see if it works for you? > -- > Robin Becker > Great - thanks a lot for implementing this! It doesn't seem to work completely. The first problem is simple (stroke opacity in shapes is applied incorrectly - see the attached patch). The second problem is that opacity doesn't seem to work on String objects. I haven't tracked that one down yet. Other than that, a simple test script seems to work, but it doesn't when incorporated into our application. I'll see if I can figure out what the problem is and let you know. Thanks again, Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: reportlab.patch Type: application/octet-stream Size: 803 bytes Desc: reportlab.patch Url : From mike at mlb.org Tue Aug 18 12:38:20 2009 From: mike at mlb.org (Mike Bernson) Date: Tue, 18 Aug 2009 12:38:20 -0400 Subject: [reportlab-users] Problem with Type1 fonts and gs. Message-ID: <4A8AD8FC.2030309@mlb.org> I am having a problem creating a pdf that will print. I am running linux (ubuntu 9.04) with reportlab version 2.3 installed by apt-get. The code look as close to the example in the doc as I can get. The file is type 1 file from gs. /usr/share/fonts/type1/gsfonts/n019003l.pfb: PostScript Type 1 font program data /usr/share/fonts/type1/gsfonts/n019003l.afm: ASCII font metrics The output from pdfinfo: name type emb sub uni object ID ------------------------------------ ----------------- --- --- --- --------- Helvetica Type 1 no no no 2 0 NimbusSanL-Regu Type 1 yes no no 5 0 both acroread and xpdf can both handle the font. If on run gs on the pdf I get the following error: mike at mike-laptop:~/src/myranch/report/report/reportgen 308> gs test.pdf GPL Ghostscript 8.64 (2009-02-03) Copyright (C) 2009 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... 3842416 1896651 10232952 8927311 3 done. Error: /typecheck in --run-- Operand stack: --nostringval-- --dict:8/17(L)-- F2 32 --dict:9/9(L)-- --dict:9/9(L)-- --nostringval-- --nostringval-- Encoding Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- Dictionary stack: --dict:1147/1684(ro)(G)-- --dict:1/20(G)-- --dict:74/200(L)-- --dict:74/200(L)-- --dict:106/127(ro)(G)-- --dict:278/300(ro)(G)-- --dict:22/25(L)-- --dict:4/6(L)-- --dict:25/40(L)-- Current allocation mode is local GPL Ghostscript 8.64: Unrecoverable error, exit code 1 Here is the code that created the pdf: import os import reportlab from reportlab.pdfbase import pdfmetrics from reportlab.pdfgen import canvas folder = '/usr/share/fonts/type1/gsfonts' afmFile = os.path.join(folder, 'n019003l.afm') pfbFile = os.path.join(folder, 'n019003l.pfb') justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile) faceName = 'NimbusSanL-Regu' pdfmetrics.registerTypeFace(justFace) justFont = pdfmetrics.Font(faceName, faceName, 'WinAnsiEncoding') pdfmetrics.registerFont(justFont) c = canvas.Canvas('test.pdf') c.setFont(faceName, 32) c.drawString(10, 150, 'This should be in') c.drawString(10, 100, faceName) c.showPage() c.save() From robin at reportlab.com Wed Aug 19 05:47:43 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 19 Aug 2009 10:47:43 +0100 Subject: [reportlab-users] Transparency In-Reply-To: <8D20BBB55F590E42AADF592A815E86170449C537@zuk35exm65.ds.mot.com> References: <4A8AAE8E.3020707@chamonix.reportlab.co.uk> <8D20BBB55F590E42AADF592A815E86170449C537@zuk35exm65.ds.mot.com> Message-ID: <4A8BCA3F.9020905@chamonix.reportlab.co.uk> .......... > Great - thanks a lot for implementing this! > > It doesn't seem to work completely. The first problem is simple (stroke > opacity in shapes is applied incorrectly - see the attached patch). The > second problem is that opacity doesn't seem to work on String objects. I > haven't tracked that one down yet. > thanks for the patch it was cut 'n paste error bah :( Not sure why string opacity shouldn't work; we're just setting an extended graphics state so it should apply to all fills/strokes etc etc. Of course text does have a separate kind of existence in PDF. I have changed the original test in test_platypus_general.py to output some strings using canvas.drawString and the opacity stuff seems to work there at least in the acrobat viewer (see attached). I suppose the String objects must be doing something special. The renderPDF drawString seems to use canvas beginText ...endText to draw the string, but that seems to be what canvas drawString does. > Other than that, a simple test script seems to work, but it doesn't when > incorporated into our application. I'll see if I can figure out what the > problem is and let you know. -- Robin Becker -------------- next part -------------- A non-text attachment was scrubbed... Name: test_pdfgen_general_spots.zip Type: application/x-zip-compressed Size: 1700 bytes Desc: not available Url : From carl at personnelware.com Wed Aug 19 12:52:30 2009 From: carl at personnelware.com (Carl Karsten) Date: Wed, 19 Aug 2009 11:52:30 -0500 Subject: [reportlab-users] upc barcodes Message-ID: <549053140908190952v4b9ebf5akd291bda60df227bc@mail.gmail.com> I poked around and found old list posts suggesting I can print UPC barcodes, but I can't find the details. So what are the details? -- Carl K From marco.parenzan at libero.it Thu Aug 20 04:01:07 2009 From: marco.parenzan at libero.it (Marco Parenzan) Date: Thu, 20 Aug 2009 10:01:07 +0200 Subject: [reportlab-users] IronPython and ReportLab Message-ID: <007801ca216c$5f5c9cd0$1e15d670$@parenzan@libero.it> Dear All, I'm trying to use IronPython 2.0.2 with ReportLab PDF. I have downloaded it (version 2.3) with FePy for unicodedata.py. I used this code for testing (from Magnus Lie Hetland "Beginning Python"): from reportlab.graphics.shapes import Drawing, String from reportlab.graphics import renderPDF d = Drawing(100, 100) s = String(50, 50, "Hello World", textAlign='middle') d.add(s) renderPDF.drawToFile(d, "HelloWorld.pdf", "HW") The execution fails: Traceback (most recent call last): File "renderPDF01.py", line 9, in renderPDF01.py File "C:\marco.parenzan\Python\reportlab\graphics\renderPDF.py", line 268, in drawToFile File "C:\marco.parenzan\Python\reportlab\pdfgen\canvas.py", line 947, in save File "C:\marco.parenzan\Python\reportlab\pdfbase\pdfdoc.py", line 223, in SaveToFile File "C:\marco.parenzan\Python\reportlab\pdfbase\pdfdoc.py", line 245, in GetPDFData File "C:\marco.parenzan\Python\reportlab\pdfbase\pdfdoc.py", line 422, in format File "C:\marco.parenzan\Python\reportlab\pdfbase\pdfdoc.py", line 883, in format File "mscorlib", line unknown, in GetString File "mscorlib", line unknown, in GetChars File "mscorlib", line unknown, in Fallback File "mscorlib", line unknown, in Throw UnicodeDecodeError: ('unknown', u'\x93', 11, 12, '') The failed row shows: 882: def format(self, document): 883: strings = map(str, self.strings) # final conversion, in case of lazy objects 884: return string.join(strings, "") I have discovered that the problem is in this string, that is the header for the PDF file: # Following Ken Lunde's advice and the PDF spec, this includes # some high-order bytes. I chose the characters for Tokyo # in Shift-JIS encoding, as these cannot be mistaken for # any other encoding, and we'll be able to tell if something # has run our PDF files through a dodgy Unicode conversion. PDFHeader = ( "%PDF-1.3"+LINEEND+ "%\223\214\213\236 ReportLab Generated PDF document http://www.reportlab.com "+LINEEND) Which is appended at the beginning of str variable. The problem is in the four characters: \223\214\213\236, which are badly converted into Unicode. Accordingly to the comment (and to PDF documentation) the four bytes are not fixed, but can be any number, better if >128 because of automatic detection as binary, not text. If I convert them into full-code Unicode characters \x00DF\x00D6\x00D5\x00EC, all is ok. "%\x00DF\x00D6\x00D5\x00EC ReportLab Generated PDF document http://www.reportlab.com"+LINEEND)" Do you know why? Uuhh, reportLab is very long to execute (Vista32, CoreDuo 2.5GHz, 4GbRAM):about 20 seconds. Marco [dot] Parenzan [at] libero [dot] it -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Thu Aug 20 05:06:41 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 20 Aug 2009 10:06:41 +0100 Subject: [reportlab-users] upc barcodes In-Reply-To: <549053140908190952v4b9ebf5akd291bda60df227bc@mail.gmail.com> References: <549053140908190952v4b9ebf5akd291bda60df227bc@mail.gmail.com> Message-ID: <4A8D1221.70606@chamonix.reportlab.co.uk> Carl Karsten wrote: > I poked around and found old list posts suggesting I can print UPC > barcodes, but I can't find the details. So what are the details? > In the reportlab/graphics/barcode folder are some modules that implement barcodes. We do ean and friends in the module eanbc.py. The test.py module draws barcodes using the platypus story framework. It is also possible to draw barcodes directly onto a canvas. -- Robin Becker From robin at reportlab.com Thu Aug 20 05:10:49 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 20 Aug 2009 10:10:49 +0100 Subject: [reportlab-users] IronPython and ReportLab In-Reply-To: <007801ca216c$5f5c9cd0$1e15d670$@parenzan@libero.it> References: <007801ca216c$5f5c9cd0$1e15d670$@parenzan@libero.it> Message-ID: <4A8D1319.8020205@chamonix.reportlab.co.uk> Marco, in CPython reportlab we expect all strings to be either bytes in utf8 encoding or unicode. I suspect that the default string encoding in ironpython is something other than that so a lot of reportlab string handling may be broken. Does ironpython support unicode directly ie u'Hello World'? I would not expect reportlab to work out of the box with ironpython. PDF doesn't use unicode (normally) and most of the output is in Adobe specific encodings. I don't think the real problem lies in our use of strange bytes (although that may not help). If the string in question is the special sequence we use at the beginning of the document then the issue is deeper since that string doesn't normally require any special manipulation (ie we expect it to appear literally in the output as a sequence of bytes). If we are unable to write bytes directly to a file then many other problems will also need to be found and fixed. This problem also arises in Python 3.x so may eventually be solved for you. As to why reportlab takes so long to execute I cannot say. -- Robin Becker From tony at spamexperts.com Thu Aug 20 05:20:25 2009 From: tony at spamexperts.com (Tony Meyer) Date: Thu, 20 Aug 2009 21:20:25 +1200 Subject: [reportlab-users] IronPython and ReportLab In-Reply-To: <4A8D1319.8020205@chamonix.reportlab.co.uk> References: <4A8D1319.8020205@chamonix.reportlab.co.uk> Message-ID: (For context, I've only ever used ReportLab with CPython. I do use IronPython for other things, though). > Does ironpython support unicode directly ie u'Hello World'? Yes. IronPython is like Python 3.x in that there are only unicode strings (`str is unicode` evaluates to True). > As to why reportlab takes so long to execute I cannot say. IronPython is faster than CPython with some things, but CPython is much, much faster at starting up than IronPython. I suspect that Marco is just seeing the regular slow startup of IronPython. Cheers, Tony From marco.parenzan at libero.it Thu Aug 20 05:38:42 2009 From: marco.parenzan at libero.it (Marco Parenzan) Date: Thu, 20 Aug 2009 11:38:42 +0200 Subject: [reportlab-users] IronPython and ReportLab Message-ID: <008801ca217a$017c23c0$04746b40$@parenzan@libero.it> Robin and Tony, thanks for the answers. I'm a .NET developer and I'm in my real first days with IPY. I strongly believe in Python and Reporting is my choice to make some real apps. I understant about ASCII and Unicode (I have read about it somewhere): I'm lucky that, at the moment, it's the only problem and the patch is simple. About performances: IPY 2.6beta2 cuts execution by about 60% (8 seconnds instead of 20). I posted the same message on IPY group: I hope having some answers soon. Thanks, Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Aug 20 13:55:25 2009 From: timr at probo.com (Tim Roberts) Date: Thu, 20 Aug 2009 10:55:25 -0700 Subject: [reportlab-users] IronPython and ReportLab In-Reply-To: <007801ca216c$5f5c9cd0$1e15d670$@parenzan@libero.it> References: <007801ca216c$5f5c9cd0$1e15d670$@parenzan@libero.it> Message-ID: <4A8D8E0D.3070508@probo.com> Marco Parenzan wrote: > > > > I?m trying to use IronPython 2.0.2 with ReportLab PDF. I have > downloaded it (version 2.3) with FePy for unicodedata.py. > > I used this code for testing (from Magnus Lie Hetland ?Beginning Python?): > > ... > > I have discovered that the problem is in this string, that is the > header for the PDF file: > > > > # Following Ken Lunde's advice and the PDF spec, this includes > > # some high-order bytes. I chose the characters for Tokyo > > # in Shift-JIS encoding, as these cannot be mistaken for > > # any other encoding, and we'll be able to tell if something > > # has run our PDF files through a dodgy Unicode conversion. > > PDFHeader = ( > > "%PDF-1.3"+LINEEND+ > > "%\223\214\213\236 ReportLab Generated PDF document > http://www.reportlab.com"+LINEEND ) > > > > Which is appended at the beginning of str variable. The problem is in > the four characters: \223\214\213\236, which are badly converted into > Unicode. Accordingly to the comment (and to PDF documentation) the > four bytes are not fixed, but can be any number, better if >128 > because of automatic detection as binary, not text. If I convert them > into full-code Unicode characters \x00DF\x00D6\x00D5\x00EC, all is ok. > > > > "%\x00DF\x00D6\x00D5\x00EC ReportLab Generated PDF document > http://www.reportlab.com"+LINEEND)? > Escape codes without an "x" are actually in octal, not decimal. Hence, the \223 in that first byte is \x93, not \xDF, which is why the error refers to \x93. However, you can't really use \x0093, because U+0093 is a control character that won't map to a printable character in any 8-bit encoding. This is a tricky problem. The desire is to use characters that will map to bytes greater than 127 when IronPython converts it to an 8-bit encoding for writing out to file. The original 4 bytes in Shift-JIS actually map to two Unicode code points, U+6771 and U+4EAC (I think). Thus, a faithful translation would actually read: "%\x6771\x4EAC ReportLab Generated..." But that's not practical, because you'd have to have a Kanji code page in place before IronPython could write this as an 8-bit file. (Or UTF-8.) The 4 characters you accidentally chose are a reasonable compromise; those are Latin-1 characters (the German "ss", O with dots, O with tilde, small i with grave accent). They will work with most of the Latin and European code pages, but they won't work in Far East code pages. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From arkadi at smartbit.be Fri Aug 21 07:40:02 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Fri, 21 Aug 2009 13:40:02 +0200 Subject: [reportlab-users] multiple frames on one page Message-ID: <4A8E8792.2030108@smartbit.be> Hi all, I'm having a problem with frames and pagetemplates. As you can see in the code below I would like to have 2 frames on the first page but only one frame(the first one:Fcover) is showing. Because the complete file is quite big I only included parts of the code. I hope this is ok for trying to locate the problem. Thanks in advance. Arkadi Colson doc = ssDocTemplate(outputfile) frame1 = Frame(85*mm,30*mm,125*mm,55*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover',showBoundary=0) frame2 = Frame(10*mm,20*mm,100*mm,50*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover2',showBoundary=0) doc.addPageTemplates( PageTemplate( id = 'cover', frames = [frame1,frame2], pagesize = (210*mm, 297*mm), onPage = self.FirstPage ) ) story.append( NextPageTemplate('cover') ) class ssDocTemplate(SimpleDocTemplate): def multiBuild(self, story, canvasMaker=Canvas, onFirstPage="_doNothing", onLaterPages="_doNothing"): self._calc() if onFirstPage is "_doNothing" and hasattr(self,'onFirstPage'): print "222" self.pageTemplates[0].beforeDrawPage = self.onFirstPage if onLaterPages is "_doNothing" and hasattr(self,'onLaterPages'): print "222" self.pageTemplates[1].beforeDrawPage = self.onLaterPages SimpleDocTemplate.multiBuild(self, story, canvasMaker) def afterPage(self): self.numPages = max(self.canv.getPageNumber(), self.numPages) PageNumber = pageNumber() PageNumber.drawPageNr( self.canv, self.canv.getPageNumber(), self.title ) def progresshandler(self, what, arg): if what=='STARTED': self._lastnumPages = self.numPages def afterInit(self): self.numPages = 1 self._lastnumPages = 0 self.setProgressCallBack(self.progresshandler) def _allSatisfied(self): if self._lastnumPages < self.numPages: return 0 return BaseDocTemplate._allSatisfied(self) def getTotalPages(self): return self._lastnumPages def setTitle(self, title): self.title = title From robin at reportlab.com Fri Aug 21 08:19:42 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 21 Aug 2009 13:19:42 +0100 Subject: [reportlab-users] multiple frames on one page In-Reply-To: <4A8E8792.2030108@smartbit.be> References: <4A8E8792.2030108@smartbit.be> Message-ID: <4A8E90DE.20107@chamonix.reportlab.co.uk> Arkadi Colson wrote: > Hi all, > > I'm having a problem with frames and pagetemplates. As you can see in > the code below I would like to have 2 frames on the first page but only > one frame(the first one:Fcover) is showing. Because the complete file is > quite big I only included parts of the code. I hope this is ok for > trying to locate the problem. > ....... Not sure what's wrong if anything with your code. It's too comlex/incomplete to get any idea of where things are going wrong. Did you start from a working example? This code ########################################################## class ssDocTemplate(BaseDocTemplate): _invalidInitArgs = ('pageTemplates',) def __init__(self, filename, **kw): frame1 = Frame(85*mm,30*mm,125*mm,55*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover',showBoundary=1) frame2 = Frame(10*mm,20*mm,100*mm,50*mm,leftPadding=0*mm,rightPadding=0*mm,topPadding=0*mm,bottomPadding=0*mm,id='Fcover2',showBoundary=1) self.allowSplitting = 0 self.showBoundary = 1 apply(BaseDocTemplate.__init__, (self, filename), kw) template = PageTemplate('normal', [frame1, frame2], ssOnPage) self.addPageTemplates(template) normalStyle = ParagraphStyle(name = 'normal') story=[].append BLAHS=('STARTUP','COMPUTERS','BLAH','BUZZWORD','STARTREK','PRINTING','PYTHON') for x in xrange(20): story(Paragraph(randomText('chomsky'),normalStyle)) story(Paragraph(randomText(BLAHS[x%len(BLAHS)]),normalStyle)) story=story.__self__ doc = ssDocTemplate('test_ssDocTemplate.pdf') doc.multiBuild(story) ########################################################## appears to work and you can see that the frames are actually overlapping. -- Robin Becker From paulojbe at gmail.com Sat Aug 22 20:27:59 2009 From: paulojbe at gmail.com (Paulo Estrela) Date: Sat, 22 Aug 2009 21:27:59 -0300 Subject: [reportlab-users] Gantt charts Message-ID: Is possible to create Gantt charts (commonly used in project management) using reportab? best regards, Paulo Estrela -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Sun Aug 23 18:32:48 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Sun, 23 Aug 2009 19:32:48 -0300 Subject: [reportlab-users] Problem with embedded font, help needed Message-ID: <200908231932.48559.ralsina@netmanagers.com.ar> Hello, this is slightly offtopic because I can't reproduce this problem using only reportlab, but I am at my wits end and this is the only list I know with people who know about PDF files :-( Basically: on some RARE occasions, which I can't isolate yet, sphinx+rst2pdf will produce, via reportlab, a PDF with a font that's not embedded correctly, and then the file has no visible text in it. I hve uploaded one such file here: http://lateral.netmanagers.com.ar/static/rusty.alt.pdf Anyone has access to a preflight tool that may tell me what's wrong with it? I have processed every most parts of that file producing decent output, but when it's all done at once, this happens. Thanks in advance for any help. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From robin at reportlab.com Mon Aug 24 05:35:01 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 24 Aug 2009 10:35:01 +0100 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908231932.48559.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> Message-ID: <4A925EC5.6060906@chamonix.reportlab.co.uk> Roberto Alsina wrote: > Hello, this is slightly offtopic because I can't reproduce this problem using > only reportlab, but I am at my wits end and this is the only list I know with > people who know about PDF files :-( > > Basically: on some RARE occasions, which I can't isolate yet, sphinx+rst2pdf > will produce, via reportlab, a PDF with a font that's not embedded correctly, > and then the file has no visible text in it. > > I hve uploaded one such file here: > http://lateral.netmanagers.com.ar/static/rusty.alt.pdf > > Anyone has access to a preflight tool that may tell me what's wrong with it? > > I have processed every most parts of that file producing decent output, but > when it's all done at once, this happens. > > Thanks in advance for any help. > well opening directly with Acrobat Reader gives an error about AAAAA+DejaVuSans..... so it's broken. -- Robin Becker From ralsina at netmanagers.com.ar Mon Aug 24 06:28:44 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 24 Aug 2009 07:28:44 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <4A925EC5.6060906@chamonix.reportlab.co.uk> References: <200908231932.48559.ralsina@netmanagers.com.ar> <4A925EC5.6060906@chamonix.reportlab.co.uk> Message-ID: <200908240728.44527.ralsina@netmanagers.com.ar> On Monday 24 August 2009 06:35:01 Robin Becker wrote: > > Basically: on some RARE occasions, which I can't isolate yet, > > sphinx+rst2pdf will produce, via reportlab, a PDF with a font that's not > > embedded correctly, and then the file has no visible text in it. > > > > I hve uploaded one such file here: > > http://lateral.netmanagers.com.ar/static/rusty.alt.pdf > > > > Anyone has access to a preflight tool that may tell me what's wrong with > > it? > > > > I have processed every most parts of that file producing decent output, > > but when it's all done at once, this happens. > > > > Thanks in advance for any help. > > well opening directly with Acrobat Reader gives an error about > AAAAA+DejaVuSans..... so it's broken. Indeed, that's the problem I want help with ;-) -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From robin at reportlab.com Mon Aug 24 07:16:47 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 24 Aug 2009 12:16:47 +0100 Subject: [reportlab-users] multiple frames on one page In-Reply-To: <4A9260D7.4090609@smartbit.be> References: <4A8E8792.2030108@smartbit.be> <4A8E90DE.20107@chamonix.reportlab.co.uk> <4A9260D7.4090609@smartbit.be> Message-ID: <4A92769F.9080008@chamonix.reportlab.co.uk> Arkadi Colson wrote: > Hi, > > Thanks for the quick response. Attached you can see the complete file > but it will still not work because a lot of external classes are not > there. But maybe you can find the reason this way. > I did not start from a working example, I only needed one frame until now. > > Robin Becker wrote: >> Arkadi Colson wrote: ....... Not exactly sure what your' intending, but the two frame stuff appears to be just the cover page(s) is that correct? So far as I can tell you're doing > story.append( NextPageTemplate('cover') ) > > self.nameTxt = dom.xpath('string(/pdf/cover/nameTxt)') > self.name = dom.xpath('string(/pdf/cover/name)') > self.vakTxt = dom.xpath('string(/pdf/cover/vakTxt)') > self.vak = dom.xpath('string(/pdf/cover/vak)') > self.klasTxt = dom.xpath('string(/pdf/cover/klasTxt)') > self.klas = dom.xpath('string(/pdf/cover/klas)') > self.syTitle = dom.xpath('string(/pdf/cover/syCover)') > self.syTxt = dom.xpath('string(/pdf/cover/syTxt)') > self.sy = dom.xpath('string(/pdf/cover/sy)') > self.logo = dom.xpath('string(/pdf/cover/logo)') > self.logoWidth = int(dom.xpath('string(/pdf/cover/logoWidth)')) > self.logoHeight = int(dom.xpath('string(/pdf/cover/logoHeight)')) > self.logoValid = int(dom.xpath('string(/pdf/cover/logoValid)')) > self.ypTxt = dom.xpath('string(/pdf/cover/ypTxt)') > self.ypTitle = dom.xpath('string(/pdf/cover/ypTitle)') > self.metadataTitle = dom.xpath('string(/pdf/addons/metadataTitle)') > > > doc.setTitle(self.ypTxt+" "+self.ypTitle) > > ### Cover BEGIN > story.append( self.drawCoverInfo() ) > ### Cover END > > ### MetaData BEGIN > story.append( NextPageTemplate('metadata') ) > story.append( PageBreak() ) The NextPageTemplate is intended to prime the interpreter so that the next time you change pages you get the referred to template. I suspect that since cover is already the first page template you don't need the NextPageTemplate append at the beginning. Apart from that it looks right although if the content of drawCoverInfo were small you might not see any usage of a second template. Why don't you try tuning on all your showFrames and see where the frames actually are. -- Robin Becker From arkadi at smartbit.be Mon Aug 24 07:27:16 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Mon, 24 Aug 2009 13:27:16 +0200 Subject: [reportlab-users] multiple frames on one page In-Reply-To: <4A92769F.9080008@chamonix.reportlab.co.uk> References: <4A8E8792.2030108@smartbit.be> <4A8E90DE.20107@chamonix.reportlab.co.uk> <4A9260D7.4090609@smartbit.be> <4A92769F.9080008@chamonix.reportlab.co.uk> Message-ID: <4A927914.8060907@smartbit.be> Robin Becker wrote: > Arkadi Colson wrote: >> Hi, >> >> Thanks for the quick response. Attached you can see the complete file >> but it will still not work because a lot of external classes are not >> there. But maybe you can find the reason this way. >> I did not start from a working example, I only needed one frame until >> now. >> >> Robin Becker wrote: >>> Arkadi Colson wrote: > ....... > Not exactly sure what your' intending, but the two frame stuff appears > to be just the cover page(s) is that correct? So far as I can tell > you're doing > That's correct, only on the first page, there should be 2 frames. > >> story.append( NextPageTemplate('cover') ) >> >> self.nameTxt = dom.xpath('string(/pdf/cover/nameTxt)') >> self.name = dom.xpath('string(/pdf/cover/name)') >> self.vakTxt = dom.xpath('string(/pdf/cover/vakTxt)') >> self.vak = dom.xpath('string(/pdf/cover/vak)') >> self.klasTxt = dom.xpath('string(/pdf/cover/klasTxt)') >> self.klas = dom.xpath('string(/pdf/cover/klas)') >> self.syTitle = dom.xpath('string(/pdf/cover/syCover)') >> self.syTxt = dom.xpath('string(/pdf/cover/syTxt)') >> self.sy = dom.xpath('string(/pdf/cover/sy)') >> self.logo = dom.xpath('string(/pdf/cover/logo)') >> self.logoWidth = >> int(dom.xpath('string(/pdf/cover/logoWidth)')) >> self.logoHeight = >> int(dom.xpath('string(/pdf/cover/logoHeight)')) >> self.logoValid = >> int(dom.xpath('string(/pdf/cover/logoValid)')) >> self.ypTxt = dom.xpath('string(/pdf/cover/ypTxt)') >> self.ypTitle = dom.xpath('string(/pdf/cover/ypTitle)') >> self.metadataTitle = >> dom.xpath('string(/pdf/addons/metadataTitle)') >> >> >> doc.setTitle(self.ypTxt+" "+self.ypTitle) >> >> ### Cover BEGIN >> story.append( self.drawCoverInfo() ) >> ### Cover END >> >> ### MetaData BEGIN >> story.append( NextPageTemplate('metadata') ) >> story.append( PageBreak() ) > The NextPageTemplate is intended to prime the interpreter so that the > next time you change pages you get the referred to template. I suspect > that since cover is already the first page template you don't need the > NextPageTemplate append at the beginning. Apart from that it looks > right although if the content of drawCoverInfo were small you might > not see any usage of a second template. > Correct, so I removed the first NextPageTemplate but no changes. OK, I added some spacers to the end of the first template and now it seems to work. I didn't knew this and it is very logic of course. Thanks a lot for the helping me out of this!!! > > Why don't you try tuning on all your showFrames and see where the > frames actually are. From ralsina at netmanagers.com.ar Mon Aug 24 10:17:57 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 24 Aug 2009 11:17:57 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908231932.48559.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> Message-ID: <200908241117.58262.ralsina@netmanagers.com.ar> On Sunday 23 August 2009 19:32:48 Roberto Alsina wrote: > Hello, this is slightly offtopic because I can't reproduce this problem > using only reportlab, but I am at my wits end and this is the only list I > know with people who know about PDF files :-( > > Basically: on some RARE occasions, which I can't isolate yet, > sphinx+rst2pdf will produce, via reportlab, a PDF with a font that's not > embedded correctly, and then the file has no visible text in it. After three days of losing hair, I fixed it. And it **may** be useful for someone else in the future: DO NOT TRY TO SAVE A PDF TO A STRINGIO. It looks like it works, it gives no errors, and then it **may** strip the high bits of some pieces of the file, breaking it in unpredictable ways. That's all :-) -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From peter at maubp.freeserve.co.uk Mon Aug 24 10:32:38 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 24 Aug 2009 15:32:38 +0100 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908241117.58262.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241117.58262.ralsina@netmanagers.com.ar> Message-ID: <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> On Mon, Aug 24, 2009 at 3:17 PM, Roberto Alsina wrote: > > On Sunday 23 August 2009 19:32:48 Roberto Alsina wrote: >> Hello, this is slightly offtopic because I can't reproduce this problem >> using only reportlab, but I am at my wits end and this is the only list I >> know with people who know about PDF files :-( >> >> Basically: on some RARE occasions, which I can't isolate yet, >> sphinx+rst2pdf will produce, via reportlab, a PDF with a font that's not >> embedded correctly, and then the file has no visible text in it. > > After three days of losing hair, I fixed it. And it **may** be useful for > someone else in the future: > > DO NOT TRY TO SAVE A PDF TO A STRINGIO. > > It looks like it works, it gives no errors, and then it **may** strip the high > bits of some pieces of the file, breaking it in unpredictable ways. > > That's all :-) Was that using StringIO or cStringIO? It might also be Python version or even OS dependent... Peter From ralsina at netmanagers.com.ar Mon Aug 24 10:38:11 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 24 Aug 2009 11:38:11 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241117.58262.ralsina@netmanagers.com.ar> <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> Message-ID: <200908241138.11771.ralsina@netmanagers.com.ar> On Monday 24 August 2009 11:32:38 Peter wrote: > > After three days of losing hair, I fixed it. And it **may** be useful for > > someone else in the future: > > > > DO NOT TRY TO SAVE A PDF TO A STRINGIO. > > > > It looks like it works, it gives no errors, and then it **may** strip the > > high bits of some pieces of the file, breaking it in unpredictable ways. > > > > That's all :-) > > Was that using StringIO or cStringIO? It might also be Python version > or even OS dependent... It was a StringIO which I think uses cStringIO if it's available, and python 2.6. Anyway, it's not worth the problem even to debug unless you really, really, really want to avoid creating a tempfile (say, if you are in google app engine). -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From gherman at darwin.in-berlin.de Mon Aug 24 10:49:04 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon, 24 Aug 2009 16:49:04 +0200 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908241138.11771.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241117.58262.ralsina@netmanagers.com.ar> <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> <200908241138.11771.ralsina@netmanagers.com.ar> Message-ID: Roberto Alsina: > It was a StringIO which I think uses cStringIO if it's available, > and python > 2.6. > > Anyway, it's not worth the problem even to debug unless you really, > really, > really want to avoid creating a tempfile (say, if you are in google > app > engine). I'm saving lots of PDFs into cStringIO.StringIO objects (also using DejaVuSans) and I never observed this issue, so far... BTW, saving to memory should be much faster than to and from a disk, and it helps extending the life time of your disk. Regards, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From robin at reportlab.com Mon Aug 24 11:15:45 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 24 Aug 2009 16:15:45 +0100 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241117.58262.ralsina@netmanagers.com.ar> <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> <200908241138.11771.ralsina@netmanagers.com.ar> Message-ID: <4A92AEA1.5000400@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Roberto Alsina: > >> It was a StringIO which I think uses cStringIO if it's available, and >> python >> 2.6. >> >> Anyway, it's not worth the problem even to debug unless you really, >> really, >> really want to avoid creating a tempfile (say, if you are in google app >> engine). > > > I'm saving lots of PDFs into cStringIO.StringIO objects (also > using DejaVuSans) and I never observed this issue, so far... > I think Dinu is right here; unless some kind of string conversions are going on it should be OK to write PDFs into a filelike object such as StringIO.StringIO and read it back without problems. Indeed internally fonts are often handled that way eg ttfonts.py > def makeStream(self): > "Finishes the generation and returns the TTF file as a string" > stm = StringIO() where the subset fonts are created as filelike objects. All the writes are done using the stm.write method though. > BTW, saving to memory should be much faster than to and from > a disk, and it helps extending the life time of your disk. > > Regards, > > Dinu ......... -- Robin Becker From ralsina at netmanagers.com.ar Mon Aug 24 11:41:57 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Mon, 24 Aug 2009 12:41:57 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <4A92AEA1.5000400@chamonix.reportlab.co.uk> References: <200908231932.48559.ralsina@netmanagers.com.ar> <4A92AEA1.5000400@chamonix.reportlab.co.uk> Message-ID: <200908241241.57720.ralsina@netmanagers.com.ar> On Monday 24 August 2009 12:15:45 Robin Becker wrote: > I think Dinu is right here; unless some kind of string conversions are > going on it should be OK to write PDFs into a filelike object such as > StringIO.StringIO and read it back without problems. Surely I was mixing some unicode and non-unicode object, or something like that. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From marius at gedmin.as Tue Aug 25 04:48:44 2009 From: marius at gedmin.as (Marius Gedminas) Date: Tue, 25 Aug 2009 11:48:44 +0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908241241.57720.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <4A92AEA1.5000400@chamonix.reportlab.co.uk> <200908241241.57720.ralsina@netmanagers.com.ar> Message-ID: <20090825084844.GB27213@platonas> On Mon, Aug 24, 2009 at 12:41:57PM -0300, Roberto Alsina wrote: > On Monday 24 August 2009 12:15:45 Robin Becker wrote: > > I think Dinu is right here; unless some kind of string conversions are > > going on it should be OK to write PDFs into a filelike object such as > > StringIO.StringIO and read it back without problems. > > Surely I was mixing some unicode and non-unicode object, or something like > that. Do you have a small example that reproduces the problem? I find it hard to believe that ReportLab would try to write unicode strings directly into the file object; we'd get *tons* of unicode errors if that ever happened. Marius Gedminas -- Un*x admins know what they are doing by definition. -- Bernd Petrovitsch -------------- 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 Aug 25 06:12:28 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 25 Aug 2009 07:12:28 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <20090825084844.GB27213@platonas> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241241.57720.ralsina@netmanagers.com.ar> <20090825084844.GB27213@platonas> Message-ID: <200908250712.28426.ralsina@netmanagers.com.ar> On Tuesday 25 August 2009 05:48:44 Marius Gedminas wrote: > On Mon, Aug 24, 2009 at 12:41:57PM -0300, Roberto Alsina wrote: > > On Monday 24 August 2009 12:15:45 Robin Becker wrote: > > > I think Dinu is right here; unless some kind of string conversions are > > > going on it should be OK to write PDFs into a filelike object such as > > > StringIO.StringIO and read it back without problems. > > > > Surely I was mixing some unicode and non-unicode object, or something > > like that. > > Do you have a small example that reproduces the problem? Not using RL directly, this is via rst2pdf. I do have two very small PDF's, one that has the problem and one that doesn't, and the fragment of code using the StringIO, if that's good enough. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From marius at gedmin.as Tue Aug 25 08:22:23 2009 From: marius at gedmin.as (Marius Gedminas) Date: Tue, 25 Aug 2009 15:22:23 +0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908250712.28426.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241241.57720.ralsina@netmanagers.com.ar> <20090825084844.GB27213@platonas> <200908250712.28426.ralsina@netmanagers.com.ar> Message-ID: <20090825122223.GA613@platonas> On Tue, Aug 25, 2009 at 07:12:28AM -0300, Roberto Alsina wrote: > On Tuesday 25 August 2009 05:48:44 Marius Gedminas wrote: > > On Mon, Aug 24, 2009 at 12:41:57PM -0300, Roberto Alsina wrote: > > > On Monday 24 August 2009 12:15:45 Robin Becker wrote: > > > > I think Dinu is right here; unless some kind of string conversions are > > > > going on it should be OK to write PDFs into a filelike object such as > > > > StringIO.StringIO and read it back without problems. > > > > > > Surely I was mixing some unicode and non-unicode object, or something > > > like that. > > > > Do you have a small example that reproduces the problem? > > Not using RL directly, this is via rst2pdf. > > I do have two very small PDF's, one that has the problem and one that doesn't, > and the fragment of code using the StringIO, if that's good enough. It would be interesting. The first thing that comes into mind is that maybe you're writing the contents of the StringIO object into a file object opened in text mode on a Windows system, but I'm sure you would notice something like that. Marius Gedminas -- Linux. Where do you want to go tomorrow? -------------- 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 Aug 25 08:28:26 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 25 Aug 2009 09:28:26 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <20090825122223.GA613@platonas> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908250712.28426.ralsina@netmanagers.com.ar> <20090825122223.GA613@platonas> Message-ID: <200908250928.26257.ralsina@netmanagers.com.ar> On Tuesday 25 August 2009 09:22:23 Marius Gedminas wrote: > It would be interesting. > > The first thing that comes into mind is that maybe you're writing the > contents of the StringIO object into a file object opened in text mode > on a Windows system, but I'm sure you would notice something like that. Nope, all Linux all the time here ;-) Here's the change that "fixed" this (see pdfbuilder.py), http://code.google.com/p/rst2pdf/source/detail?r=883 and I am pretty sure now the problem is that I am not using StringIO correctly. Before I did this: sio=StringIO('') [create the PDF in sio] self.output=unicode(sio.getvalue(),'utf-8','ignore') #This looks fishy! And here's what now works: tmpname=tempfile.mktemp() [create the PDF in tmpname] self.output=open(tmpname).read() I am now guessing I am decoding sio.getvalue() to unicode but shouldn't. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From ralsina at netmanagers.com.ar Tue Aug 25 08:31:27 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Tue, 25 Aug 2009 09:31:27 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <20090825122223.GA613@platonas> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908250712.28426.ralsina@netmanagers.com.ar> <20090825122223.GA613@platonas> Message-ID: <200908250931.27729.ralsina@netmanagers.com.ar> And I forgot, but here's the broken/correct PDFs. No font embedding was necessary, the "broken" one has a broken xref table, because of the same problem. In both cases, it's a PDF with one page showing a "X". -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) -------------- next part -------------- A non-text attachment was scrubbed... Name: ok.pdf Type: application/pdf Size: 1755 bytes Desc: not available Url : -------------- next part -------------- A non-text attachment was scrubbed... Name: broken.pdf Type: application/pdf Size: 1763 bytes Desc: not available Url : From andy at reportlab.com Tue Aug 25 10:59:25 2009 From: andy at reportlab.com (Andy Robinson) Date: Tue, 25 Aug 2009 15:59:25 +0100 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908241138.11771.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908241117.58262.ralsina@netmanagers.com.ar> <320fb6e00908240732g55f7ca3dyf89f0d978a162fe1@mail.gmail.com> <200908241138.11771.ralsina@netmanagers.com.ar> Message-ID: <956003ae0908250759m24fa5d6exa5259277190e5d59@mail.gmail.com> 2009/8/24 Roberto Alsina : >> > DO NOT TRY TO SAVE A PDF TO A STRINGIO. >> Was that using StringIO or cStringIO? It might also be Python version >> or even OS dependent... > > It was a StringIO which I think uses cStringIO if it's available, and python > 2.6. We have been running production web apps for many years which save PDFs to a cStringIO. I suspect the problem was that the cStringIO module was not compiled or loaded in your case. Nevertheless if any flavour of StringIO reproducibly corrupts input, I'd suggest that's a bug worth reporting to the Python folks. - Andy From gherman at darwin.in-berlin.de Tue Aug 25 14:10:52 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue, 25 Aug 2009 20:10:52 +0200 Subject: [reportlab-users] Dynamic cell content in tables? Message-ID: Hi, I'm having fun with tables, again. Is there a way to have repeating header and/or (ideally: and) footer rows that contain something like subtotals, say, of a column as shown inside a page or frame? Thanks, Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From andy at reportlab.com Wed Aug 26 03:27:50 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 26 Aug 2009 08:27:50 +0100 Subject: [reportlab-users] Dynamic cell content in tables? In-Reply-To: References: Message-ID: <956003ae0908260027r677a7d77u2f815f13f797673a@mail.gmail.com> 2009/8/25 Dinu Gherman : > Hi, > > I'm having fun with tables, again. Is there a way to have repeating > header and/or (ideally: and) footer rows that contain something > like subtotals, say, of a column as shown inside a page or frame? No. It's an annoying gap in our table model. You really need some hook so that when doing a footer, it's possible to retrospectively access the cells which were placed on the same page, so that you can do your own totalling. At the present time the programmer would have to break the table into page-sized chunks and work out the totals themselves before going into Platypus. - Andy From gherman at darwin.in-berlin.de Wed Aug 26 04:57:24 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed, 26 Aug 2009 10:57:24 +0200 Subject: [reportlab-users] Dynamic cell content in tables? In-Reply-To: <956003ae0908260027r677a7d77u2f815f13f797673a@mail.gmail.com> References: <956003ae0908260027r677a7d77u2f815f13f797673a@mail.gmail.com> Message-ID: Andy Robinson: > No. > > It's an annoying gap in our table model. You really need some > hook so that when doing a footer, it's possible to retrospectively > access the cells which were placed on the same page, so that you > can do your own totalling. At the present time the programmer would > have to break the table into page-sized chunks and work out the totals > themselves before going into Platypus. That's what I thought. Which is why I solved my issue entirely without Platypus. That was possible, because the document was mostly only one big table. And, yes, it is a pain... That said, (static) table footers would already be helpful. It would be nice for the table class to have some propepr hooks called when a frame/page split does occur. That would make things almost trivial. Makes me think of an altertables package... ;-) Dinu ...................................................................... Follow me on Twitter: http://twitter.com/dinugherman From robin at reportlab.com Wed Aug 26 05:50:28 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 26 Aug 2009 10:50:28 +0100 Subject: [reportlab-users] Dynamic cell content in tables? In-Reply-To: References: <956003ae0908260027r677a7d77u2f815f13f797673a@mail.gmail.com> Message-ID: <4A950564.7090700@chamonix.reportlab.co.uk> Dinu Gherman wrote: > Andy Robinson: > >> No. >> >> It's an annoying gap in our table model. You really need some >> hook so that when doing a footer, it's possible to retrospectively >> access the cells which were placed on the same page, so that you >> can do your own totalling. At the present time the programmer would >> have to break the table into page-sized chunks and work out the totals >> themselves before going into Platypus. ....... I'm not exactly sure if a lazy flowable approach might not work. I'm fairly sure that if the content of a flowable in a repeatable header were dynamic it would/could draw different content each time it was used. > That's what I thought. Which is why I solved my issue entirely > without Platypus. That was possible, because the document was > mostly only one big table. And, yes, it is a pain... > > That said, (static) table footers would already be helpful. It > would be nice for the table class to have some propepr hooks > called when a frame/page split does occur. That would make > things almost trivial. The table class does have a split method (and _splitRows), but there is no method that hooks the internal split creation itself. Effectively we have two creations R0 = self.__class__( data[:n], colWidths=self._colWidths, rowHeights=self._argH[:n], repeatRows=repeatRows, repeatCols=repeatCols, splitByRow=splitByRow) and later if repeatRows: R1 = self.__class__(data[:repeatRows]+data[n:],colWidths=self._colWidths, rowHeights=self._argH[:repeatRows]+self._argH[n:], repeatRows=repeatRows, repeatCols=repeatCols, splitByRow=splitByRow) or R1 = self.__class__(data[n:], colWidths=self._colWidths, rowHeights=self._argH[n:], repeatRows=repeatRows, repeatCols=repeatCols, splitByRow=splitByRow) presumably for R0 and R1 we need to inform at creation time that they are offspring of an earlier table and which part of the split they are. Possibly we could add an afterSplit method ie def afterSplit(self,parent,splitPart,splitByRow=True): ....... that should allow table classes to mess around with their data as they see fit. I suspect that in fact you'll need finer control than just the split ie some indication that the footers/headers etc are about to be drawn. That might make the dynamic lazy flowable approach easier. However, since we don't have footers as yet, we have a problem doing that. Footers would be a good start. However, I think they complicate things quite a bit. > > Makes me think of an altertables package... ;-) > > Dinu .......... -- Robin Becker From marius at gedmin.as Wed Aug 26 10:34:56 2009 From: marius at gedmin.as (Marius Gedminas) Date: Wed, 26 Aug 2009 17:34:56 +0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <200908250928.26257.ralsina@netmanagers.com.ar> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908250712.28426.ralsina@netmanagers.com.ar> <20090825122223.GA613@platonas> <200908250928.26257.ralsina@netmanagers.com.ar> Message-ID: <20090826143456.GC25803@platonas> On Tue, Aug 25, 2009 at 09:28:26AM -0300, Roberto Alsina wrote: > On Tuesday 25 August 2009 09:22:23 Marius Gedminas wrote: > > It would be interesting. > > > > The first thing that comes into mind is that maybe you're writing the > > contents of the StringIO object into a file object opened in text mode > > on a Windows system, but I'm sure you would notice something like that. > > Nope, all Linux all the time here ;-) > > Here's the change that "fixed" this (see pdfbuilder.py), > > http://code.google.com/p/rst2pdf/source/detail?r=883 > > and I am pretty sure now the problem is that I am not using StringIO > correctly. > > Before I did this: > > sio=StringIO('') > [create the PDF in sio] > self.output=unicode(sio.getvalue(),'utf-8','ignore') #This looks fishy! Precisely. You take a binary string and randomly remove bits of it (those substrings that aren't valid UTF-8 sequences). Don't do that. > And here's what now works: > > tmpname=tempfile.mktemp() > [create the PDF in tmpname] > self.output=open(tmpname).read() Assuming this is Python 2.x, you get an 8-bit string from file.read(), so the StringIO-equivalent of self.output = sio.getvalue() should also work. > I am now guessing I am decoding sio.getvalue() to unicode but shouldn't. Yes. Marius Gedminas -- Truth does not demand belief. Scientists do not join hands every Sunday, singing, 'Yes, gravity is real! I will have faith! I will be strong! I believe in my heart that what goes up, up, up must come down, down, down. Amen!' If they did, we would think they were pretty insecure about it. - Dan Barker -------------- 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 Wed Aug 26 10:50:44 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 26 Aug 2009 11:50:44 -0300 Subject: [reportlab-users] Problem with embedded font, help needed In-Reply-To: <20090826143456.GC25803@platonas> References: <200908231932.48559.ralsina@netmanagers.com.ar> <200908250928.26257.ralsina@netmanagers.com.ar> <20090826143456.GC25803@platonas> Message-ID: <200908261150.44173.ralsina@netmanagers.com.ar> On Wednesday 26 August 2009 11:34:56 Marius Gedminas wrote: > Assuming this is Python 2.x, you get an 8-bit string from file.read(), > so the StringIO-equivalent of > > self.output = sio.getvalue() > > should also work. Indeed it seems to work. > > I am now guessing I am decoding sio.getvalue() to unicode but shouldn't. > > Yes. You know, if I did drink, I woud assume I was drunk that day. I need to use svn blame on myself :-) -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From jim at qlf.com Wed Aug 26 10:58:21 2009 From: jim at qlf.com (Jim Steil) Date: Wed, 26 Aug 2009 09:58:21 -0500 Subject: [reportlab-users] Row height in tables Message-ID: <4A954D8D.8020209@qlf.com> Hi I'm having trouble finding out how to set the spacing between rows in a table. No matter what I set my font size to, the space between rows is too large. I can't find a setting to change it. What am I missing? -Jim From ralsina at netmanagers.com.ar Wed Aug 26 11:46:27 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Wed, 26 Aug 2009 12:46:27 -0300 Subject: [reportlab-users] Row height in tables In-Reply-To: <4A954D8D.8020209@qlf.com> References: <4A954D8D.8020209@qlf.com> Message-ID: <200908261246.27501.ralsina@netmanagers.com.ar> On Wednesday 26 August 2009 11:58:21 Jim Steil wrote: > Hi > > I'm having trouble finding out how to set the spacing between rows in a > table. No matter what I set my font size to, the space between rows is > too large. I can't find a setting to change it. What am I missing? Could be the PADDING commands in the table. By default they are something like 3 or 6 points. -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From mjf at pearson.co.uk Wed Aug 26 12:17:31 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Wed, 26 Aug 2009 17:17:31 +0100 Subject: [reportlab-users] Row height in tables In-Reply-To: <200908261246.27501.ralsina@netmanagers.com.ar> References: <4A954D8D.8020209@qlf.com> <200908261246.27501.ralsina@netmanagers.com.ar> Message-ID: <4A95601B.50200@pearson.co.uk> Roberto Alsina wrote: > On Wednesday 26 August 2009 11:58:21 Jim Steil wrote: >> Hi >> >> I'm having trouble finding out how to set the spacing between rows in a >> table. No matter what I set my font size to, the space between rows is >> too large. I can't find a setting to change it. What am I missing? > > Could be the PADDING commands in the table. By default they are something like > 3 or 6 points. > I think LEADING too, which defaults to 12. From paulojbe at gmail.com Wed Aug 26 13:30:07 2009 From: paulojbe at gmail.com (Paulo Estrela) Date: Wed, 26 Aug 2009 14:30:07 -0300 Subject: [reportlab-users] Installing report lab 2.3 on red hat 4.7 Message-ID: Did anyone install reportlab 2.3 on redhat/centos 4.7? I have the following packages installed, but python "setup.py build_ext -i" says that JPEG and FREETYPE2 support is not available. libjpeg-6b-33.i386 libjpeg-6b-33.x86_64 libjpeg-devel-6b-33.x86_64 freetype-2.1.9-8.el4.6.i386 freetype-devel-2.1.9-8.el4.6.x86_64 freetype-demos-2.1.9-8.el4.6.x86_64 freetype-2.1.9-8.el4.6.x86_64 freetype-utils-2.1.9-8.el4.6.x86_64 Thanks, Paulo Estrela http://tabugado.com http://pauloestrela.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From paulojbe at gmail.com Wed Aug 26 13:59:56 2009 From: paulojbe at gmail.com (Paulo Estrela) Date: Wed, 26 Aug 2009 14:59:56 -0300 Subject: [reportlab-users] Installing report lab 2.3 on red hat 4.7 In-Reply-To: References: Message-ID: Sorry... my problem is related to PIL!! My mistake! Paulo Estrela http://tabugado.com http://pauloestrela.wordpress.com On Wed, Aug 26, 2009 at 2:30 PM, Paulo Estrela wrote: > > Did anyone install reportlab 2.3 on redhat/centos 4.7? I have the following > packages installed, but python "setup.py build_ext -i" says that JPEG and > FREETYPE2 support is not available. > > libjpeg-6b-33.i386 > libjpeg-6b-33.x86_64 > libjpeg-devel-6b-33.x86_64 > > freetype-2.1.9-8.el4.6.i386 > freetype-devel-2.1.9-8.el4.6.x86_64 > freetype-demos-2.1.9-8.el4.6.x86_64 > freetype-2.1.9-8.el4.6.x86_64 > freetype-utils-2.1.9-8.el4.6.x86_64 > > > Thanks, > > Paulo Estrela > http://tabugado.com > http://pauloestrela.wordpress.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ralsina at netmanagers.com.ar Fri Aug 28 14:33:23 2009 From: ralsina at netmanagers.com.ar (Roberto Alsina) Date: Fri, 28 Aug 2009 15:33:23 -0300 Subject: [reportlab-users] BUG: Indenters not allowed in table cells? Message-ID: <200908281533.23146.ralsina@netmanagers.com.ar> I had a problem doing this in rst2pdf, but I am now thinking this may be a reportlab limitation. If I use an Indenter flowable in a cell, I get an exception about Indenters not having a width. This is with RL 2.3 Here's the test program: http://pastebin.ca/1546099 Here's the exception: Traceback (most recent call last): File "test_issue_173.py", line 24, in go() File "test_issue_173.py", line 22, in go doc.build(Story) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 1010, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 777, in build self.handle_flowable(flowables) File "/usr/lib/python2.6/site-packages/reportlab/platypus/doctemplate.py", line 665, in handle_flowable if frame.add(f, canv, trySplit=self.allowSplitting): File "/usr/lib/python2.6/site-packages/reportlab/platypus/frames.py", line 159, in _add w, h = flowable.wrap(aW, h) File "/usr/lib/python2.6/site-packages/reportlab/platypus/tables.py", line 1092, in wrap self._calc(availWidth, availHeight) File "/usr/lib/python2.6/site-packages/reportlab/platypus/tables.py", line 587, in _calc self._calc_height(availHeight,availWidth,W=W) File "/usr/lib/python2.6/site-packages/reportlab/platypus/tables.py", line 525, in _calc_height dW,t = self._listCellGeom(v,w or self._listValueWidth(v),s) File "/usr/lib/python2.6/site-packages/reportlab/platypus/tables.py", line 375, in _listCellGeom vw, vh = v.wrapOn(canv, aW, aH) File "/usr/lib/python2.6/site-packages/reportlab/platypus/flowables.py", line 116, in wrapOn w, h = self.wrap(aW,aH) File "/usr/lib/python2.6/site-packages/reportlab/platypus/flowables.py", line 124, in wrap return (self.width, self.height) AttributeError: Indenter instance has no attribute 'width' -- ("\''/").__..-''"`-. . Roberto Alsina `9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH) (_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar _..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia (l)-'' ((i).' ((!.' according to alexa.com (27/5/2007) From hwaye at microwayes.net Sat Aug 29 11:56:22 2009 From: hwaye at microwayes.net (Harry Waye) Date: Sat, 29 Aug 2009 16:56:22 +0100 Subject: [reportlab-users] Canvas background Message-ID: <1251561382.7424.8.camel@aspire> Hello, I'm trying to merge (using pyPdf) a template pdf with a pdf generated from rml with trml2pdf. The rml generated pdf appears to have a white background, thus obscures the template pdf on merging. I would like it to be transparent. Is this something that can be specified in rml? Is there any way I can import the template pdf on generation? I noticed there was an include pdf tag in the rml user guide, but I get the feeling that it places the included pdf on top. Is there anything else I can do? Is placing a background colour on the pdf an attempt to stop me doing such things, and to push be to PageCatcher? ;-) Cheers, Harry From jugovich at gmail.com Mon Aug 31 16:54:12 2009 From: jugovich at gmail.com (Michael Jugovich) Date: Mon, 31 Aug 2009 15:54:12 -0500 Subject: [reportlab-users] frame question Message-ID: <19a8487c0908311354q2816e02am9a8b20a98ec2f0aa@mail.gmail.com> Hi, I am new to ReportLab and having difficulty using split with a paragraph flowable. I want to split the paragraph and have it flow into the same frame onto the next page. Currently the split paragraph simply flows into the next available frame. I have tried things such as catching the wrap and to check available height/width then split, splitting on the paragraph, splitting on the frame, etc. But I have not had any success. Could someone help me out or point me to some good documentation/code examples for splitting. Attached is the source for the script. Below is the function that deals with the splitting. Thanks for the help! Michael Jugovich National Opinion Research Center Survey Specialist I # where s = story, t = text, d = dict, doc = document object #keywords: #sort = x where x is element to sort on #reverse, if set to True reverses the sort def print_freq(s,t,d,doc,**kw): aW = PAGE_WIDTH/3 aH = PAGE_HEIGHT - inch*2.5 out = t s.append(Paragraph(out,style = h1_style)) s.append(Spacer(1,0.2*inch)) if 'sort' in kw: if 'reverse' in kw: d = sorted(d, key=operator.itemgetter(kw['sort']), reverse = True) else: d = sorted(d, key=operator.itemgetter(kw['sort'])) out='' for x in d: out = out + x[0] + " : " + str(x[1]) +'
' p = Paragraph(out,style = text_style) o = frame_left.split(p, doc) for y in o: s.append(y) s.append(FrameBreak()) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- ''' Created on Aug 28, 2009 @author: Jugovich-Michael ''' import operator, re from datetime import date import cardsharp as cs from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter, A4, landscape from reportlab.lib.units import inch from reportlab.platypus import BaseDocTemplate, Paragraph, Frame, PageTemplate, Spacer, FrameBreak from reportlab.lib.styles import ParagraphStyle, TA_LEFT, black from reportlab.rl_config import defaultPageSize #program settings cs.settings.log = True src = r'P:\6423\Common\PROD\SAS\DATA\gmsbase_copy.sav' # declare global variables and containers PAGE_HEIGHT=defaultPageSize[1] PAGE_WIDTH=defaultPageSize[0] completes = set() end_q = dict() timed_out = dict() stopped = dict() endq_timed_out = dict() endq_stopped = dict() today = date.today() story = [] # define frames frame_title = Frame(0*inch, inch*9.5, PAGE_WIDTH, 1*inch, id='f_title') frame_left = Frame(0*inch, 0*inch, PAGE_WIDTH/3, PAGE_HEIGHT - inch*2.5, id='left_col') frame_middle = Frame(0*inch + PAGE_WIDTH/3, 0, PAGE_WIDTH/3, PAGE_HEIGHT - inch*2.5, id='mid_col') frame_right = Frame(0*inch + PAGE_WIDTH/1.5, 0, PAGE_WIDTH/3, PAGE_HEIGHT - inch*2.5, id='right_col') # define pageTemplates - for page in document mainPage = PageTemplate(id='main_template', frames=[frame_title, frame_left, frame_middle, frame_right]) # set styles title_style = ParagraphStyle('report_title', fontSize=14, alignment=1) h1_style = ParagraphStyle('report_h1', fontSize=12) text_style = ParagraphStyle('report', fontSize=8, alignment=1) # load data def _rename(s): if s == 'DataCollection_EndQuestion': return 'end_q' elif s == 'DataCollection_Status_03': return 'timed_out' elif s == 'DataCollection_Status_05': return 'stopped' else: return s d1 = cs.load(src, rename = _rename) # load functions # get_Freq -> stores desired variable value as a key # and its frequency as the corresponding value #r = row, v = variable name, d = container dictionary def get_freq(r, v, d): if r[v] in d: d[r[v]] += 1 else: d[r[v]] = 1 def make_stats(row): #get list of completes, for total number of completes completes.add(row['su_id']) #get dict of end questions and frequency get_freq(row, 'end_q', end_q) #get dict of Timed_out/stopped respondents and their end_question #get dict of frequency of timed_out/stopped variables if row['timed_out'] == 1: timed_out[row['su_id']] = row['end_q'] get_freq(row, 'end_q', endq_timed_out) if row['stopped'] == 1: stopped[row['su_id']] = row['end_q'] get_freq(row, 'end_q', endq_stopped) def clear_containers(): completes.clear() end_q.clear() timed_out.clear() stopped.clear() endq_timed_out.clear() endq_stopped.clear() # where s = story, t = text, d = dict, doc = document object #keywords: #sort = x where x is element to sort on #reverse, if set to True reverses the sort def print_freq(s,t,d,doc,**kw): aW = PAGE_WIDTH/3 aH = PAGE_HEIGHT - inch*2.5 out = t s.append(Paragraph(out,style = h1_style)) s.append(Spacer(1,0.2*inch)) if 'sort' in kw: if 'reverse' in kw: d = sorted(d, key=operator.itemgetter(kw['sort']), reverse = True) else: d = sorted(d, key=operator.itemgetter(kw['sort'])) out='' for x in d: out = out + x[0] + " : " + str(x[1]) +'
' p = Paragraph(out,style = text_style) o = frame_left.split(p, doc) for y in o: s.append(y) s.append(FrameBreak()) def make_pdf(survey): # PDF Properties t = 'GMS %s daily report: ' % survey + str(today) a = "Michael Jugovich" page_info = "Daily Report" # define BasicDocTemplate - for document doc = BaseDocTemplate('gms_%s_report_' % survey + str(today) +'.pdf', pagesize=letter, pageTemplates=mainPage, leftMargin=72, title=t, author=a, showBoundary=1) #make title out = 'GMS %s daily report: ' % survey + str(today) story.append(Paragraph(out,style = title_style)) story.append(Spacer(1,0.2*inch)) #print total number of completes out = 'Total Cases Completed: ' + str(len(completes)) story.append(Paragraph(out,style = h1_style)) story.append(FrameBreak()) #print end questions with their frequencies k = end_q.keys() temp = set() for x in k: temp.add((x, end_q[x])) print_freq(story, 'End Question : Frequency', temp,doc,sort=1, reverse=True) #print timed_out/stopped respondents and their corresponding end_questions #print_freq(story,'TIMED_OUT : End Question',timed_out.items(), sort=1) doc.build(story) d1.transform(make_stats) cs.wait() make_pdf('C9 Baseline') #print_data() #create story