From Y.Forkl at srz.de Thu Apr 2 10:22:15 2009 From: Y.Forkl at srz.de (Yves Forkl) Date: Thu, 02 Apr 2009 16:22:15 +0200 Subject: [reportlab-users] Table cell contents misaligned (RLTK > 2.0) Message-ID: <49D4CA17.9010905@srz.de> Hello, some time ago I set up an application using RLTK 2.0. Trying to migrate it to RLTK 2.3, I discovered that RLTK 2.3 behaves differently: I'm using Platypus to build up a table. In each row, some of the cells contain a Paragraph instance, other cells just receive a string. Now with RLTK 2.3 (but not with RLTK 2.0), the "Paragraph cells" have their baseline shifted up a bit (vertically aligned to the middle??). The font size, font name and leading are the same for both types of cells, i.e. my TableStyle instance (applying to the string-only cells) uses the same values for these parameters as does my ParagraphStyle instance. Why did Platypus change its behaviour here? I've looked for a way to directly influence vertical alignment, but did not find any. As a workaround, I have empirically determined that I need to decrease the Paragraph leading to 4.71 while keeping the general table leading at 7 (with a font size of 8 in both) to make the baselines align again... (NB: I don't use TOPPADDING or BOTTOMPADDING at all. Tried to fiddle with them once by setting them to 0, but that did not align the baselines again.) Does anybody know of a real solution that could replace my clumsy workaround? Yves From gherman at darwin.in-berlin.de Thu Apr 2 10:44:16 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu, 2 Apr 2009 16:44:16 +0200 Subject: [reportlab-users] Table cell contents misaligned (RLTK > 2.0) In-Reply-To: <49D4CA17.9010905@srz.de> References: <49D4CA17.9010905@srz.de> Message-ID: <98726C14-14FD-4CD5-A6DA-91812BB7FBB9@darwin.in-berlin.de> Yves Forkl: > Does anybody know of a real solution that could replace my clumsy > workaround? Not a real solution, but I'm using an ugly hack inserting an additional Spacer in the cells containing Paragraphs to compensate for the vertical shift. I'd also be very interested in a true solution and some motivation for changing/breaking the previous behaviour. Regards, Dinu From andy at reportlab.com Thu Apr 2 10:53:23 2009 From: andy at reportlab.com (Andy Robinson) Date: Thu, 2 Apr 2009 15:53:23 +0100 Subject: [reportlab-users] Table cell contents misaligned (RLTK > 2.0) In-Reply-To: <98726C14-14FD-4CD5-A6DA-91812BB7FBB9@darwin.in-berlin.de> References: <49D4CA17.9010905@srz.de> <98726C14-14FD-4CD5-A6DA-91812BB7FBB9@darwin.in-berlin.de> Message-ID: <956003ae0904020753vfe4c937u960892632cd4632f@mail.gmail.com> 2009/4/2 Dinu Gherman : > > I'd also be very interested in a true solution and some > motivation for changing/breaking the previous behaviour. I was not aware of this I can assure you no one has deliberately changed this; it must be a sideeffect of something else. We're having a mad week now (last 3 days of UK tax year, many systems we maintain getting updated) but will try to find out what happened and why, and whether we could revert without breaking something else. It makes sense that text-in-cells and paras-in-cells should share a baseline. There are many projects where we start with short plain text strings, then have to change one column to have wrapping paragraphs. I've logged this in the tracker - Andy From mjf at pearson.co.uk Thu Apr 2 11:01:05 2009 From: mjf at pearson.co.uk (Matt Folwell) Date: Thu, 02 Apr 2009 16:01:05 +0100 Subject: [reportlab-users] Table cell contents misaligned (RLTK > 2.0) In-Reply-To: <956003ae0904020753vfe4c937u960892632cd4632f@mail.gmail.com> References: <49D4CA17.9010905@srz.de> <98726C14-14FD-4CD5-A6DA-91812BB7FBB9@darwin.in-berlin.de> <956003ae0904020753vfe4c937u960892632cd4632f@mail.gmail.com> Message-ID: <49D4D331.6040001@pearson.co.uk> Andy Robinson wrote: > 2009/4/2 Dinu Gherman : >> I'd also be very interested in a true solution and some >> motivation for changing/breaking the previous behaviour. > > I was not aware of this I can assure you no one has deliberately > changed this; it must be a sideeffect of something else. > > We're having a mad week now (last 3 days of UK tax year, > many systems we maintain getting updated) but will > try to find out what happened and why, and whether we > could revert without breaking something else. > > It makes sense that text-in-cells and paras-in-cells should > share a baseline. There are many projects where we start > with short plain text strings, then have to change one > column to have wrapping paragraphs. > > I've logged this in the tracker It's a side-effect of changing Paragraph to position its baseline according to the ascent and descent read from the font. I submitted a patch a while ago to do the same with table strings, but it must have slipped through the cracks. My patch (which was against 2.2) is at http://two.pairlist.net/pipermail/reportlab-users/2008-September/007414.html Regards, Matt -- Matt Folwell Senior Programmer Pearson Publishing Group Chesterton Mill, French's Road, Cambridge CB4 3NP Tel: +44 1223 350555 Fax: +44 1223 356484 http://www.pearson.co.uk/ From peter at maubp.freeserve.co.uk Thu Apr 2 12:29:13 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Thu, 2 Apr 2009 17:29:13 +0100 Subject: [reportlab-users] Website queries Message-ID: <320fb6e00904020929u2b692aefnd2da989edab3d22d@mail.gmail.com> Hi, I just noticed http://www.reportlab.org/rl_toolkit.html has the following link: > > For latest features, see the Release Note. > First of all people normally talk about "Release Notes" plural, my main reason for emailing is the page this links to http://www.reportlab.org/relnotes.html is very out of date - it still talks about version 1.20 and 2.0 Also, I had a query about the dependencies listed on the downloads page, http://www.reportlab.org/downloads.html > > If you want to use GIF or PNG images in your PDFs, you will > also need to obtain the Python Imaging Library.. > Notice there are two full stops. Also, does the PIL requirement apply to all the bitmap output (e.g. JPG files)? Thanks, Peter From robin at reportlab.com Thu Apr 2 13:13:41 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 02 Apr 2009 18:13:41 +0100 Subject: [reportlab-users] Table cell contents misaligned (RLTK > 2.0) In-Reply-To: <49D4CA17.9010905@srz.de> References: <49D4CA17.9010905@srz.de> Message-ID: <49D4F245.5070005@chamonix.reportlab.co.uk> The layout algorithm in tables claims to know about strings, but it cannot know about flowables/paragraphs etc etc in general. Therefore a string which has a reference point called the baseline can be adjusted and I believe that's what's intended here. Unfortunately, the code for paragraph was updated to use the actual Ascent/Descent figures. If you run this script ############################ from reportlab.platypus.paragraph import Paragraph from reportlab.platypus.tables import Table, TableStyle from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.platypus.doctemplate import SimpleDocTemplate from reportlab.lib.colors import blue styleSheet = getSampleStyleSheet() bt=styleSheet['BodyText'] fontName=bt.fontName fontSize=bt.fontSize leading=bt.leading t=Table( [['Up and Downy', Paragraph('Up and Downy',bt)]], 2*[None],[None], TableStyle([ ('FONT', (0,0), (-1,-1), fontName,fontSize,leading), ('TOPPADDING', (0,0), (-1,-1), 0), ('LEFTPADDING', (0,0), (-1,-1), 0), ('RIGHTPADDING', (0,0), (-1,-1), 0), ('BOTTOMPADDING', (0,0), (-1,-1), 0), ('VALIGN', (0,0), (-1,-1), 'TOP'), ('GRID', (0,0), (-1,-1), 0.25, blue), ]), ) SimpleDocTemplate('tth.pdf').build([t]) ############################ then the observed difference in the positions is entirely explained by the difference between using fontsize and ascent in the statement at line 1414 in tables.py (method _drawCell). > elif valign=='TOP': > from reportlab.pdfbase.pdfmetrics import stringWidth, getFont, getAscentDescent > ascent, descent = getAscentDescent(cellstyle.fontname,fontsize) > y = rowpos + rowheight - cellstyle.topPadding - ascent #fontsize if you try changing the code to the above then the two layouts match. Here ascent,descent=6.83,-2.17 not 10 and -2 so our old approximation is wrong. Arguably the ascent is more accurate as it brings the top of the letters to the top of the cell in this case which is where TOP should make it. The real problem is that we've assumed 1.2*fontSize=leading and arguable it should be smaller. -- Robin Becker From arkadi at smartbit.be Fri Apr 3 03:32:26 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Fri, 03 Apr 2009 09:32:26 +0200 Subject: [reportlab-users] Vertical text in table cell Message-ID: <49D5BB8A.1060001@smartbit.be> Hi all, I have a simple question. Is it possible to put text vertical in a table cell? If yes, how can I do it and will the cell height expand also? Thanks in advance. Best regards, Arkadi Colson From gherman at darwin.in-berlin.de Fri Apr 3 04:04:57 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 3 Apr 2009 10:04:57 +0200 Subject: [reportlab-users] Vertical text in table cell In-Reply-To: <49D5BB8A.1060001@smartbit.be> References: <49D5BB8A.1060001@smartbit.be> Message-ID: Arkadi Colson: > I have a simple question. > Is it possible to put text vertical in a table cell? If yes, > how can I do it and will the cell height expand also? The simple answer is, yes, it's possible. I don't have the time to make a count, but I think it's a FAQ, or rather a FARAQ, a "frequently asked, but rarely answered question". If you can wait a bit, I'll dig out some code later today... Regards, Dinu From aribao at gmail.com Fri Apr 3 08:22:35 2009 From: aribao at gmail.com (=?iso-8859-1?q?Adri=E1n_Ribao_Martinez?=) Date: Fri, 3 Apr 2009 14:22:35 +0200 Subject: [reportlab-users] Help with BaseDocTemplate class Message-ID: <200904031422.35373.aribao@gmail.com> Hello, I have subclass of BaseDocTemplate named MyDocTemplate. I'm using it to overwrite the afterFlowable method. Before doing this, I used the SimpleDocTemplate, so I was able to use onLaterPages and onFirstPage arguments. Now I can't, and I need to achieve the same results using BaseDocTemplate. So far I have: class MyDocTemplate(BaseDocTemplate): def __init__(self, filename, **kw): self.allowSplitting = 0 apply(BaseDocTemplate.__init__, (self, filename), kw) first_template = PageTemplate(id='First',frames=[Frame(2.5*cm, 2.0*cm, 17*cm, 25*cm, id='F2')], onPage=FirstPage) template = PageTemplate(id='Normal',frames=[Frame(2.5*cm, 2.0*cm, 17*cm, 25*cm, id='F1')], onPage=Page) self.addPageTemplates([first_template, template]) def afterFlowable(self, flowable): ... What should I do to insert the FirstPage as first page? I want to get the same results as I got with SimpleDocTemplate. Thank you! -- Adri?n Ribao Mart?nez From gherman at darwin.in-berlin.de Fri Apr 3 11:07:58 2009 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri, 3 Apr 2009 17:07:58 +0200 Subject: [reportlab-users] Vertical text in table cell In-Reply-To: <49D5C39E.5070707@smartbit.be> References: <49D5BB8A.1060001@smartbit.be> <49D5C39E.5070707@smartbit.be> Message-ID: <416BFCB3-AA62-4C47-B846-D297304E3878@darwin.in-berlin.de> Arkadi Colson: > Thanks a lot. That would be great! Take your time, somewhere > next week is also ok for me... Here's some sample code... Hope, that helps! @RL: Feel free to add this to your FAQ... Regards, Dinu -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: test_rotated_cells.py Type: text/x-python-script Size: 1668 bytes Desc: not available Url : From my123678 at yahoo.fr Sat Apr 4 14:34:17 2009 From: my123678 at yahoo.fr (=?iso-8859-1?Q?andr=E9_malassi?=) Date: Sat, 4 Apr 2009 18:34:17 +0000 (GMT) Subject: [reportlab-users] Trying to keep it simple Message-ID: <336409.51461.qm@web27701.mail.ukl.yahoo.com> Hello, In a project I'm working at, it is needed that we would be able to generate some extraction of basic data's from an SQL database. One of the constraints is that reports needs to be generated at the server level , and sent back to the client (a single page or two) Finally, my thinking is that only the user name could be sent as an input to our reportlab generator thus it should work on like this : 1 - website : send an http request with 'username' as a parameter 2 - reportlabserver : receive the username and does an SQL select in the database to get the rows we want 'select name, city,date,customerid from clients where username like '%s' order by date desc limit 100' % self.GetInputValue('UserName') At this time the pdf would be generated on the server 3 - get the pdf back to the client (if possible without having to perform a second operation to get the file) As far as I can think the only thing I know is theSQL part of it, and that we have Python working and sudo apt-get install done for reportlab ! Sorry if my English is not perfect and thanks in advance for any help,of any kind, because i truly believe I need some ! -- Andr? -------------- next part -------------- An HTML attachment was scrubbed... URL: From kreno at yumaed.org Mon Apr 6 10:39:24 2009 From: kreno at yumaed.org (Kerri Reno) Date: Mon, 6 Apr 2009 08:39:24 -0600 Subject: [reportlab-users] Fwd: text of paragraph sits at bottom of area. In-Reply-To: References: Message-ID: I sent this question last month. I'm sorry if I worded it badly or something, but I got no response. Can anyone help me with this? I'm writing a paragraph directly to a canvas, and the text is bottom oriented. Please help me with this! Kerri ---------- Forwarded message ---------- From: Kerri Reno Date: Fri, Mar 13, 2009 at 11:22 AM Subject: text of paragraph sits at bottom of area. To: Support list for users of Reportlab software < reportlab-users at reportlab.com> I'm creating a pay stub with reportlab, that has to fit on one page. I started with Jeff Bauer's hcfa1500.py from the reportlab web site - THANKS JEFF! I was able to modify it to fit my needs, even including a couple of paragraphs. My problem is that the paragraphs print in the bottom of the allowed area. I'm using stylesheet = getSampleStyleSheet() style = stylesheet['Normal'] style.fontName=self.text_font style.fontSize = self.text_size style.leading = int(self.text_size * 1.2) c = self.canvas # x, y = bottom left corner of area # width and height are the maximum area I want the # paragraph to use up p = Paragraph(v,style) f = KeepInFrame(width,height,[p],mode='shrink') f.wrapOn(c,width,height) f.drawOn(c,x,y) This works great, except if the text of the paragraph doesn't take up all the space, then it prints in the bottom portion of the area. I've searched the documentation and the web for an answer, and I just can't find it. I'd appreciate any help you can give me. Thanks in Advance! Kerri -- Yuma Educational Computer Consortium Compass Development Team Kerri Reno kreno at yumaed.org (928) 502-4240 .?:*??*:?. .?:*??*:?. .?:*??*:?. -- Yuma Educational Computer Consortium Compass Development Team Kerri Reno kreno at yumaed.org (928) 502-4240 .?:*??*:?. .?:*??*:?. .?:*??*:?. -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Apr 6 13:35:39 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 06 Apr 2009 10:35:39 -0700 Subject: [reportlab-users] Fwd: text of paragraph sits at bottom of area. In-Reply-To: References: Message-ID: <49DA3D6B.6070808@probo.com> Kerri Reno wrote: > I sent this question last month. I'm sorry if I worded it badly or > something, but I got no response. Can anyone help me with this? I'm > writing a paragraph directly to a canvas, and the text is bottom > oriented. Please help me with this! Could you possibly include a runnable sample that demonstrates the problem? It's a little hard to discern exactly what you mean from the example. I would point out that coordinates in Postscript do start at the bottom of the page and go up. If you have a chunk of text of variable height, and you draw it at (72,72), it will always draw at the lower-left corner of the page. If you want it to draw with the top of the paragraph 5 inches above the bottom of the page, then you need to compute the Y coordinate as 5 * inch - paragraph.height. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From avera at coes.org.pe Mon Apr 6 16:24:10 2009 From: avera at coes.org.pe (Alberto Vera) Date: Mon, 06 Apr 2009 15:24:10 -0500 Subject: [reportlab-users] Create a PDF file from Ms. Office Word format. In-Reply-To: <49DA3D6B.6070808@probo.com> References: <49DA3D6B.6070808@probo.com> Message-ID: <49DA64EA.2030302@coes.org.pe> Hello. Could you tell me how I can create a PDF file from Word(Ms.office)? Is it possible to do that programatically? Regards From timr at probo.com Mon Apr 6 16:38:11 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 06 Apr 2009 13:38:11 -0700 Subject: [reportlab-users] Create a PDF file from Ms. Office Word format. In-Reply-To: <49DA64EA.2030302@coes.org.pe> References: <49DA3D6B.6070808@probo.com> <49DA64EA.2030302@coes.org.pe> Message-ID: <49DA6833.9000005@probo.com> Alberto Vera wrote: > > Could you tell me how I can create a PDF file from Word(Ms.office)? > Is it possible to do that programatically? Not with ReportLab. That's not what it is for. There are many tools to do this, however. I like PDFCreator, which is a free, open source tool. Like most such tools, it installs itself as a fake printer: you print to the PDFCreator printer, and it produces a PDF file. In Office 2007, Word has this ability built-in. No add-ons are needed. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From jim at qlf.com Mon Apr 6 17:49:42 2009 From: jim at qlf.com (Jim Steil) Date: Mon, 06 Apr 2009 16:49:42 -0500 Subject: [reportlab-users] Image Library not Available Message-ID: <49DA78F6.9030005@qlf.com> Hi I get this message on my development box whenever I try to insert an image into my report. But, it worked fine in the past on a previous dev box and works fine on my production server. RuntimeError: Imaging Library not available, unable to import bitmaps Did I mess something up with the install on this box? -Jim From timr at probo.com Mon Apr 6 18:02:01 2009 From: timr at probo.com (Tim Roberts) Date: Mon, 06 Apr 2009 15:02:01 -0700 Subject: [reportlab-users] Image Library not Available In-Reply-To: <49DA78F6.9030005@qlf.com> References: <49DA78F6.9030005@qlf.com> Message-ID: <49DA7BD9.90903@probo.com> Jim Steil wrote: > Hi > > I get this message on my development box whenever I try to insert an > image into my report. But, it worked fine in the past on a previous > dev box and works fine on my production server. > > RuntimeError: Imaging Library not available, unable to import bitmaps > > Did I mess something up with the install on this box? Did you install PIL on this box? It's not part of ReportLab, but it is required to do imaging. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From peter at maubp.freeserve.co.uk Mon Apr 6 18:02:37 2009 From: peter at maubp.freeserve.co.uk (Peter) Date: Mon, 6 Apr 2009 23:02:37 +0100 Subject: [reportlab-users] Image Library not Available In-Reply-To: <49DA78F6.9030005@qlf.com> References: <49DA78F6.9030005@qlf.com> Message-ID: <320fb6e00904061502l5a37fc07ye918676ab0d01684@mail.gmail.com> On 4/6/09, Jim Steil wrote: > > Hi > > I get this message on my development box whenever I try to insert an image > into my report. But, it worked fine in the past on a previous dev box and > works fine on my production server. > > RuntimeError: Imaging Library not available, unable to import bitmaps > > Did I mess something up with the install on this box? Did you install the Python Imaging Library (PIL)? It is clearly listed as a dependency on the reportlab website, and is required for working with bitmaps. If you installed ReportLab using your Linux distribution's package manager, then maybe there is a missing dependency. Peter From robin at reportlab.com Tue Apr 7 05:52:21 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 07 Apr 2009 10:52:21 +0100 Subject: [reportlab-users] Fwd: text of paragraph sits at bottom of area. In-Reply-To: References: Message-ID: <49DB2255.5000303@chamonix.reportlab.co.uk> Kerri Reno wrote: ......... > > I'm creating a pay stub with reportlab, that has to fit on one page. I > started with Jeff Bauer's hcfa1500.py from the reportlab web site - THANKS > JEFF! I was able to modify it to fit my needs, even including a couple of > paragraphs. My problem is that the paragraphs print in the bottom of the > allowed area. > > I'm using > > stylesheet = getSampleStyleSheet() > style = stylesheet['Normal'] > style.fontName=self.text_font > style.fontSize = self.text_size > style.leading = int(self.text_size * 1.2) > c = self.canvas > > # x, y = bottom left corner of area > # width and height are the maximum area I want the > # paragraph to use up > p = Paragraph(v,style) > f = KeepInFrame(width,height,[p],mode='shrink') > f.wrapOn(c,width,height) > f.drawOn(c,x,y) > > This works great, except if the text of the paragraph doesn't take up all > the space, then it prints in the bottom portion of the area. > > I've searched the documentation and the web for an answer, and I just can't > find it. I'd appreciate any help you can give me. > > Thanks in Advance! > Kerri > ........ first off the normal way of drawing paragraphs is with the platypus doctemplate frame work. But if you wish to do this directly into a canvas then it's wise to know the api that's used. First off wrap/wrapOn return the width and height that is used by the flowable; eg # NB w, h don't have to be equal to width and height w,h = f.wrapOn(c,width,height) then the x and y for the drawOn correspond to the bottom left of the flowable. Assuming you wish to draw from the top down you need to subtract the height from the top left y. try this script to get some idea of where things are from reportlab.pdfgen.canvas import Canvas from reportlab.lib.styles import getSampleStyleSheet from reportlab.platypus.paragraph import Paragraph from reportlab.platypus.flowables import KeepInFrame stylesheet = getSampleStyleSheet() style = stylesheet['Normal'] style.fontName = 'Helvetica' style.fontSize = 10 style.leading = int(style.fontSize * 1.2) c = Canvas('simple.pdf') width=72 #1in x 1in width for our para height=72 #define top left tlx = 72 #one inch in from left tly = c._pagesize[1] - 72 #one inch down from top #show our area c.setLineWidth = 1 c.setStrokeColor((1,0,0)) #red c.rect(tlx,tly,width,-height,stroke=1,fill=0) p = Paragraph('This is a silly paragraph that\'s used to make up the numbers and show the world where things go.',style) f = KeepInFrame(width,height,[p],mode='shrink') w,h=f.wrapOn(c,width,height) f.drawOn(c,tlx,tly-height) c.showPage() c.save() -- Robin Becker From fjanon at gmail.com Tue Apr 7 07:35:39 2009 From: fjanon at gmail.com (Fred Janon) Date: Tue, 7 Apr 2009 19:35:39 +0800 Subject: [reportlab-users] Create a PDF file from Ms. Office Word format. In-Reply-To: <49DA64EA.2030302@coes.org.pe> References: <49DA3D6B.6070808@probo.com> <49DA64EA.2030302@coes.org.pe> Message-ID: <2fd0c7810904070435r1327fd40l492c4f7139987a3@mail.gmail.com> OpenOffice opens MS-Word documents and can generate pdf documents. It's Open Source, but I don't know how you could drive it progammatically. Maybe you can ask the question on their mailing list. Fred On Tue, Apr 7, 2009 at 04:24, Alberto Vera wrote: > Hello. > > Could you tell me how I can create a PDF file from Word(Ms.office)? > Is it possible to do that programatically? > > Regards > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From jim at qlf.com Tue Apr 7 09:36:44 2009 From: jim at qlf.com (Jim Steil) Date: Tue, 07 Apr 2009 08:36:44 -0500 Subject: [reportlab-users] Image Library not Available In-Reply-To: <49DA7BD9.90903@probo.com> References: <49DA78F6.9030005@qlf.com> <49DA7BD9.90903@probo.com> Message-ID: <49DB56EC.1030700@qlf.com> Tim Roberts wrote: > Jim Steil wrote: > >> Hi >> >> I get this message on my development box whenever I try to insert an >> image into my report. But, it worked fine in the past on a previous >> dev box and works fine on my production server. >> >> RuntimeError: Imaging Library not available, unable to import bitmaps >> >> Did I mess something up with the install on this box? >> > > Did you install PIL on this box? It's not part of ReportLab, but it is > required to do imaging. > > Thanks for the quick reply. Of course that was the problem. I just 'forgot' about that requirement when I setup my new dev box. -Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From kreno at yumaed.org Tue Apr 7 11:28:12 2009 From: kreno at yumaed.org (Kerri Reno) Date: Tue, 7 Apr 2009 09:28:12 -0600 Subject: [reportlab-users] Fwd: text of paragraph sits at bottom of area. In-Reply-To: <49DB2255.5000303@chamonix.reportlab.co.uk> References: <49DB2255.5000303@chamonix.reportlab.co.uk> Message-ID: Thanks for your suggestions! I will try them out, and let you know. Kerri On Tue, Apr 7, 2009 at 3:52 AM, Robin Becker wrote: > Kerri Reno wrote: > ......... > > >> I'm creating a pay stub with reportlab, that has to fit on one page. I >> started with Jeff Bauer's hcfa1500.py from the reportlab web site - THANKS >> JEFF! I was able to modify it to fit my needs, even including a couple of >> paragraphs. My problem is that the paragraphs print in the bottom of the >> allowed area. >> >> I'm using >> >> stylesheet = getSampleStyleSheet() >> style = stylesheet['Normal'] >> style.fontName=self.text_font >> style.fontSize = self.text_size >> style.leading = int(self.text_size * 1.2) >> c = self.canvas >> >> # x, y = bottom left corner of area >> # width and height are the maximum area I want the >> # paragraph to use up >> p = Paragraph(v,style) >> f = KeepInFrame(width,height,[p],mode='shrink') >> f.wrapOn(c,width,height) >> f.drawOn(c,x,y) >> >> This works great, except if the text of the paragraph doesn't take up all >> the space, then it prints in the bottom portion of the area. >> >> I've searched the documentation and the web for an answer, and I just >> can't >> find it. I'd appreciate any help you can give me. >> >> Thanks in Advance! >> Kerri >> >> ........ > > first off the normal way of drawing paragraphs is with the platypus > doctemplate frame work. But if you wish to do this directly into a canvas > then it's wise to know the api that's used. > > First off wrap/wrapOn return the width and height that is used by the > flowable; > > eg > # NB w, h don't have to be equal to width and height > w,h = f.wrapOn(c,width,height) > > then the x and y for the drawOn correspond to the bottom left of the > flowable. Assuming you wish to draw from the top down you need to subtract > the height from the top left y. > > > > try this script to get some idea of where things are > > from reportlab.pdfgen.canvas import Canvas > from reportlab.lib.styles import getSampleStyleSheet > from reportlab.platypus.paragraph import Paragraph > from reportlab.platypus.flowables import KeepInFrame > stylesheet = getSampleStyleSheet() > style = stylesheet['Normal'] > style.fontName = 'Helvetica' > style.fontSize = 10 > style.leading = int(style.fontSize * 1.2) > c = Canvas('simple.pdf') > > width=72 #1in x 1in width for our para > height=72 > > #define top left > tlx = 72 #one inch in from left > tly = c._pagesize[1] - 72 #one inch down from top > > #show our area > c.setLineWidth = 1 > c.setStrokeColor((1,0,0)) #red > c.rect(tlx,tly,width,-height,stroke=1,fill=0) > > p = Paragraph('This is a silly paragraph that\'s used to make up the > numbers and show the world where things go.',style) > f = KeepInFrame(width,height,[p],mode='shrink') > w,h=f.wrapOn(c,width,height) > f.drawOn(c,tlx,tly-height) > c.showPage() > c.save() > -- > Robin Becker > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Yuma Educational Computer Consortium Compass Development Team Kerri Reno kreno at yumaed.org (928) 502-4240 .?:*??*:?. .?:*??*:?. .?:*??*:?. -------------- next part -------------- An HTML attachment was scrubbed... URL: From office at tapirdata.com Tue Apr 7 17:30:16 2009 From: office at tapirdata.com (Andreas Riedl) Date: Tue, 07 Apr 2009 23:30:16 +0200 Subject: [reportlab-users] platypus.KeepTogether generates extra empty pages Message-ID: <49DBC5E8.6040500@tapirdata.com> Hi, I have encountered the following problem with 'platypus.KeepTogether': If the contents of a 'KeepTogether' doesn't fit in the current 'frame', its method 'split' unconditionally inserts a 'FrameBreak'. If this situation occurs after a 'PageBreak' or at the beginning of a document, that behavior causes the production of an extra empty frame. If the current frame was the last one of the current page that produces an extra empty page. The attachment contains a short demonstration of the problem and a suggestion on how to fix it. (set 'applyPatch' to True to use my patched 'KeepTogether', which replaces 'FrameBreak' by 'SmartFrameBreak', which checks for 'frame._atTop' ) ciao, andreas -- : XXX>-OO andreas riedl otto bauer g. 11/5 : : XX< \ | software development a-1060 wien : : XXX>-`. \ | system administration +431 9667865 : : \_ `.) www.tapirdata.com +43699 19667865 : -------------- next part -------------- A non-text attachment was scrubbed... Name: patchKeepTogether.py Type: text/x-python Size: 2530 bytes Desc: not available Url : From robin at reportlab.com Wed Apr 8 06:21:47 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 08 Apr 2009 11:21:47 +0100 Subject: [reportlab-users] platypus.KeepTogether generates extra empty pages In-Reply-To: <49DBC5E8.6040500@tapirdata.com> References: <49DBC5E8.6040500@tapirdata.com> Message-ID: <49DC7ABB.90408@chamonix.reportlab.co.uk> Andreas Riedl wrote: > Hi, > > I have encountered the following problem with 'platypus.KeepTogether': > > If the contents of a 'KeepTogether' doesn't fit in the current 'frame', > its method 'split' unconditionally inserts a 'FrameBreak'. > > If this situation occurs after a 'PageBreak' or at the beginning of a > document, > that behavior causes the production of an extra empty frame. > If the current frame was the last one of the current page that produces an > extra empty page. > > The attachment contains a short demonstration of the problem and a > suggestion > on how to fix it. (set 'applyPatch' to True to use my patched > 'KeepTogether', > which replaces 'FrameBreak' by 'SmartFrameBreak', which checks for > 'frame._atTop' ) > > ciao, andreas ........ Do you really want a page break in a KeepTogether? Smart framebreak seems like a good idea for the solution though. -- Robin Becker From office at tapirdata.com Wed Apr 8 06:41:21 2009 From: office at tapirdata.com (Andreas Riedl) Date: Wed, 08 Apr 2009 12:41:21 +0200 Subject: [reportlab-users] platypus.KeepTogether generates extra empty pages In-Reply-To: <49DC7ABB.90408@chamonix.reportlab.co.uk> References: <49DBC5E8.6040500@tapirdata.com> <49DC7ABB.90408@chamonix.reportlab.co.uk> Message-ID: <49DC7F51.9090701@tapirdata.com> Robin Becker wrote: > Do you really want a page break in a KeepTogether? Smart framebreak > seems like a good idea for the solution though. No, the 'PageBreak' occurs just before the 'KeepTogether', which results in a 'PageBreak' followed by a 'FrameBreak' thus produces an extra empty page. ciao, andreas -- : XXX>-OO andreas riedl otto bauer g. 11/5 : : XX< \ | software development a-1060 wien : : XXX>-`. \ | system administration +431 9667865 : : \_ `.) www.tapirdata.com +43699 19667865 : From esmith.fresno at gmail.com Thu Apr 9 11:47:22 2009 From: esmith.fresno at gmail.com (Edward Smith) Date: Thu, 9 Apr 2009 08:47:22 -0700 Subject: [reportlab-users] Create a PDF file from Ms. Office Word format. In-Reply-To: <49DA64EA.2030302@coes.org.pe> References: <49DA3D6B.6070808@probo.com> <49DA64EA.2030302@coes.org.pe> Message-ID: <59093b1c0904090847q7042deeaw477dbd011b61c8b3@mail.gmail.com> Hello, The solution I use requires Windows, Office and Acrobat! That being said, it is fully programmatic. My code is based on msoffice2pdf.py, from http://www.goermezer.de . He's got tons of interesting stuff on this subject, including some Open Office stuff, worth a look. Regards, Ed Smith On Mon, Apr 6, 2009 at 1:24 PM, Alberto Vera wrote: > Hello. > > Could you tell me how I can create a PDF file from Word(Ms.office)? > Is it possible to do that programatically? > > Regards > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From kreno at yumaed.org Thu Apr 9 12:12:21 2009 From: kreno at yumaed.org (Kerri Reno) Date: Thu, 9 Apr 2009 10:12:21 -0600 Subject: [reportlab-users] Fwd: text of paragraph sits at bottom of area. In-Reply-To: References: <49DB2255.5000303@chamonix.reportlab.co.uk> Message-ID: Thank you Tim and Robin for your help. That's exactly what I needed. I didn't know that wrapOn returned the size of the paragraph, so I was worried that I'd have to somehow calculate it myself, and I didn't have a clue how to do that. Thanks again! Kerri On Tue, Apr 7, 2009 at 9:28 AM, Kerri Reno wrote: > Thanks for your suggestions! I will try them out, and let you know. > > Kerri > > > On Tue, Apr 7, 2009 at 3:52 AM, Robin Becker wrote: > >> Kerri Reno wrote: >> ......... >> >> >>> I'm creating a pay stub with reportlab, that has to fit on one page. I >>> started with Jeff Bauer's hcfa1500.py from the reportlab web site - >>> THANKS >>> JEFF! I was able to modify it to fit my needs, even including a couple >>> of >>> paragraphs. My problem is that the paragraphs print in the bottom of the >>> allowed area. >>> >>> I'm using >>> >>> stylesheet = getSampleStyleSheet() >>> style = stylesheet['Normal'] >>> style.fontName=self.text_font >>> style.fontSize = self.text_size >>> style.leading = int(self.text_size * 1.2) >>> c = self.canvas >>> >>> # x, y = bottom left corner of area >>> # width and height are the maximum area I want the >>> # paragraph to use up >>> p = Paragraph(v,style) >>> f = KeepInFrame(width,height,[p],mode='shrink') >>> f.wrapOn(c,width,height) >>> f.drawOn(c,x,y) >>> >>> This works great, except if the text of the paragraph doesn't take up all >>> the space, then it prints in the bottom portion of the area. >>> >>> I've searched the documentation and the web for an answer, and I just >>> can't >>> find it. I'd appreciate any help you can give me. >>> >>> Thanks in Advance! >>> Kerri >>> >>> ........ >> >> first off the normal way of drawing paragraphs is with the platypus >> doctemplate frame work. But if you wish to do this directly into a canvas >> then it's wise to know the api that's used. >> >> First off wrap/wrapOn return the width and height that is used by the >> flowable; >> >> eg >> # NB w, h don't have to be equal to width and height >> w,h = f.wrapOn(c,width,height) >> >> then the x and y for the drawOn correspond to the bottom left of the >> flowable. Assuming you wish to draw from the top down you need to subtract >> the height from the top left y. >> >> >> >> try this script to get some idea of where things are >> >> from reportlab.pdfgen.canvas import Canvas >> from reportlab.lib.styles import getSampleStyleSheet >> from reportlab.platypus.paragraph import Paragraph >> from reportlab.platypus.flowables import KeepInFrame >> stylesheet = getSampleStyleSheet() >> style = stylesheet['Normal'] >> style.fontName = 'Helvetica' >> style.fontSize = 10 >> style.leading = int(style.fontSize * 1.2) >> c = Canvas('simple.pdf') >> >> width=72 #1in x 1in width for our para >> height=72 >> >> #define top left >> tlx = 72 #one inch in from left >> tly = c._pagesize[1] - 72 #one inch down from top >> >> #show our area >> c.setLineWidth = 1 >> c.setStrokeColor((1,0,0)) #red >> c.rect(tlx,tly,width,-height,stroke=1,fill=0) >> >> p = Paragraph('This is a silly paragraph that\'s used to make up the >> numbers and show the world where things go.',style) >> f = KeepInFrame(width,height,[p],mode='shrink') >> w,h=f.wrapOn(c,width,height) >> f.drawOn(c,tlx,tly-height) >> c.showPage() >> c.save() >> -- >> Robin Becker >> >> _______________________________________________ >> reportlab-users mailing list >> reportlab-users at reportlab.com >> http://two.pairlist.net/mailman/listinfo/reportlab-users >> > > > > -- > Yuma Educational Computer Consortium > Compass Development Team > Kerri Reno > kreno at yumaed.org (928) 502-4240 > .?:*??*:?. .?:*??*:?. .?:*??*:?. > -- Yuma Educational Computer Consortium Compass Development Team Kerri Reno kreno at yumaed.org (928) 502-4240 .?:*??*:?. .?:*??*:?. .?:*??*:?. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Y.Forkl at srz.de Tue Apr 14 10:13:03 2009 From: Y.Forkl at srz.de (Yves Forkl) Date: Tue, 14 Apr 2009 16:13:03 +0200 Subject: [reportlab-users] Truncate table cell content to end with ellipsis Message-ID: <49E499EF.6080007@srz.de> Using Platypus (RLTK 2.3), I would like to make sure that the contents of a table cell of a known fixed width do only consist of no more than a single line that is truncated if too long. An ellipsis ("...", or rather U+2026) should be substituted to the missing part. The contents are passed as a Paragraph so I can use HTML formatting, its font size and family are known of course. I already have a kind of hack which involves a function that incrementally reduces the content to be inserted (using the stringWidth method on a dummy canvas) until it fits, based on some heuristics. But I would much prefer a clean and neat solution. I know about KeepInFrame and its truncate method, but looking at the unit test in test_platypus_pleaseturnover.py I can't figure out how to proceed, especially to push the ellipsis in. Any hints? Yves From robin at reportlab.com Tue Apr 14 10:49:29 2009 From: robin at reportlab.com (Robin Becker) Date: Tue, 14 Apr 2009 15:49:29 +0100 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49E499EF.6080007@srz.de> References: <49E499EF.6080007@srz.de> Message-ID: <49E4A279.4040106@chamonix.reportlab.co.uk> Yves Forkl wrote: > Using Platypus (RLTK 2.3), I would like to make sure that the contents > of a table cell of a known fixed width do only consist of no more than a > single line that is truncated if too long. An ellipsis ("...", or rather > U+2026) should be substituted to the missing part. The contents are > passed as a Paragraph so I can use HTML formatting, its font size and > family are known of course. > > I already have a kind of hack which involves a function that > incrementally reduces the content to be inserted (using the stringWidth > method on a dummy canvas) until it fits, based on some heuristics. > > But I would much prefer a clean and neat solution. I know about > KeepInFrame and its truncate method, but looking at the unit test in > test_platypus_pleaseturnover.py I can't figure out how to proceed, > especially to push the ellipsis in. > > Any hints? > ........ it's not exactly clear what you want. If you want to ensure that a particular paragraph is only of a specified width then you need to mess around with the paragraph wrapping stuff if you need the html style formatting. If in fact you just need a string that's truncated and the end replaced with '...' then it might be better to think about messing with a Table class. Unfortunately we don't have an intermediate thing that knows about different fonts/sizes without the full horror of the paragraph class. In the paragraph approach you can do w,h = p.wrap(availWidth,0x7fffffff) to create the broken lines structure and see if the paragraph is in fact too long. Alternatively just call the paragraph's breakLines method. eg >>> from reportlab.platypus import paragraph >>> from reportlab.lib.styles import getSampleStyleSheet >>> styles=getSampleStyleSheet() >>> normal=getSampleStyleSheet()['Normal'] >>> P=paragraph.Paragraph('This is my long and tedious text',normal) >>> P.width=72 >>> blpara=P.breakLines([72]) >>> len(blpara.lines) 2 >>> blpara.lines[0] (9.4899999999999949, ['This', 'is', 'my', 'long']) The above shows what happens for a simple single style paragraph. Things will be more interesting and the blpara stuff more complex if you switch styles eg >>> P=paragraph.Paragraph('This is my long and tedious text',normal) >>> P.width=72 >>> blpara=P.breakLines([72]) >>> len(blpara.lines) 2 >>> blpara.lines[0] FragLine(ascent=6.8300000000000001, descent=-2.1699999999999999, extraSpace=9.4899999999999949, fontSize=10, lineBreak=False, wordCount=4, words=[ABag(bold=0, fontName='Times-Roman', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text='This ', textColor=Color(0,0,0), underline=0), ABag(bold=0, fontName='Times-Italic', fontSize=10, greek=0, italic=1, link=None, rise=0, strike=0, sub=0, super=0, text='is ', textColor=Color(0,0,0), underline=0), ABag(bold=0, fontName='Times-Roman', fontSize=10, greek=0, italic=0, link=None, rise=0, strike=0, sub=0, super=0, text='my long', textColor=Color(0,0,0), underline=0)]) >>> however, both allow you to estimate where the paragraph wishes to wrap the first line and how much space is left over. In the above 9.4899999999999949 is the amount of extra space that is left after putting the words onto the line (with the standard spacing). In the first case a simple list suffices to hold the strings, but in the complex case the words attribute of the FragLine holds fragment words. It should be easy to determine that 'my long' is the last thing in each case. A bit of messing with the width of your '...' char would allow some kind of outcome to be determined (probably using XPreformatted). As a last resort some kind of special flowable could be used that knows how to calculate widths of its outcome and then truncate with .... -- Robin Becker From harrelson at gmail.com Tue Apr 14 13:19:44 2009 From: harrelson at gmail.com (Culley Harrelson) Date: Tue, 14 Apr 2009 10:19:44 -0700 Subject: [reportlab-users] Adobe Reader won't print TrueType fonts Message-ID: <20090414171944.GD13704@bridge> The attached document is printable with Document Viewer (Gnome) but it will not print with Adobe Reader. The font is Cyberbit. When the font is changed to a built-in font Adobe Reader will print. I have also tried Arial Unicode (TrueType) and Adobe Reader also fails to print. What can I do to get Adobe Reader to print docs with embedded TrueType fonts? Could this be a coding issue? culley -------------- next part -------------- A non-text attachment was scrubbed... Name: cantprint.pdf Type: application/pdf Size: 36517 bytes Desc: not available Url : From Y.Forkl at srz.de Wed Apr 15 04:45:16 2009 From: Y.Forkl at srz.de (Yves Forkl) Date: Wed, 15 Apr 2009 10:45:16 +0200 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49E4A279.4040106@chamonix.reportlab.co.uk> References: <49E499EF.6080007@srz.de> <49E4A279.4040106@chamonix.reportlab.co.uk> Message-ID: <49E59E9C.9080501@srz.de> Robin Becker schrieb: > it's not exactly clear what you want. If you want to ensure that a > particular paragraph is only of a specified width then you need to mess > around with the paragraph wrapping stuff if you need the html style > formatting. If in fact you just need a string that's truncated and the > end replaced with '...' then it might be better to think about messing > with a Table class. Unfortunately we don't have an intermediate thing > that knows about different fonts/sizes without the full horror of the > paragraph class. Thank you very much for your detailed explanations and the code samples. Sorry for not having specified more clearly what I am looking for. In fact, I do need HTML formatting inside the table cell, but AFAICS I could ignore its effects when determining the width. The reason for this is that I am only using , , and . Underlining shouldn't affect the width at all. The other two elements are only capable of reducing the width a tiny bit, so ignoring them will lead to cutting off some characters more than is actually necessary, but that is OK for me. This makes me think the solution to my problem might be rather simple: Treat the content simply as a string (temporarily replacing any HTML markup), determine how many characters to cut off at the end so that appending an ellipsis will still keep the result within the first line of the table cell, replace the extraneous characters with an ellipsis, then make the result a Paragraph. How could I implement this? > In the paragraph approach you can do > > w,h = p.wrap(availWidth,0x7fffffff) > > to create the broken lines structure and see if the paragraph is in fact > too long. I assume availWidth holds the table cell width (minus padding space) in pt. But how can I know from the values of w and h (actual width and height of the para??) if the para is too wide and by how many characters I need to shorten it, or how many characters its first line may contain? (Though I suppose I don't need to work with paragraphs, as stated above.) Yves From robin at reportlab.com Wed Apr 15 05:39:20 2009 From: robin at reportlab.com (Robin Becker) Date: Wed, 15 Apr 2009 10:39:20 +0100 Subject: [reportlab-users] Adobe Reader won't print TrueType fonts In-Reply-To: <20090414171944.GD13704@bridge> References: <20090414171944.GD13704@bridge> Message-ID: <49E5AB48.5080702@chamonix.reportlab.co.uk> Hi, I tried this with acrobat reader 7.0 in windoze XP and it prints just fine. My colleague tried in Adobe Reader 8 in Xubuntu (Hardy AMD 64) and that fails to print, however, with evince 2.22.2 it does print on his machine. I have tried on my 32 bit Jaunty beta and there the document prints in evince 2.26.0, but not in acrobat 8. So mixed results. Culley Harrelson wrote: > The attached document is printable with Document Viewer (Gnome) but it will > not print with Adobe Reader. The font is Cyberbit. When the font is changed > to a built-in font Adobe Reader will print. I have also tried Arial Unicode > (TrueType) and Adobe Reader also fails to print. What can I do to get Adobe > Reader to print docs with embedded TrueType fonts? Could this be a coding > issue? > > culley ........ -- Robin Becker From harrelson at gmail.com Wed Apr 15 10:32:48 2009 From: harrelson at gmail.com (Culley Harrelson) Date: Wed, 15 Apr 2009 07:32:48 -0700 Subject: [reportlab-users] Adobe Reader won't print TrueType fonts In-Reply-To: <49E5AB48.5080702@chamonix.reportlab.co.uk> References: <20090414171944.GD13704@bridge> <49E5AB48.5080702@chamonix.reportlab.co.uk> Message-ID: <20090415143248.GI24573@bridge> It works with reader 7 on OSX and document viewer on OSX too. Must be an Acrobat 8 problem. On Wed, 15 Apr 2009, Robin Becker wrote: > Hi, I tried this with acrobat reader 7.0 in windoze XP and it prints just > fine. My colleague tried in Adobe Reader 8 in Xubuntu (Hardy AMD 64) and > that fails to print, however, with evince 2.22.2 it does print on his > machine. I have tried on my 32 bit Jaunty beta and there the document > prints in evince 2.26.0, but not in acrobat 8. > > So mixed results. > > > Culley Harrelson wrote: >> The attached document is printable with Document Viewer (Gnome) but it will >> not print with Adobe Reader. The font is Cyberbit. When the font is changed >> to a built-in font Adobe Reader will print. I have also tried Arial Unicode >> (TrueType) and Adobe Reader also fails to print. What can I do to get Adobe >> Reader to print docs with embedded TrueType fonts? Could this be a coding >> issue? >> >> culley > ........ > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From aaron.barlow at gmail.com Wed Apr 15 11:57:15 2009 From: aaron.barlow at gmail.com (Aaron Barlow) Date: Wed, 15 Apr 2009 09:57:15 -0600 Subject: [reportlab-users] Adobe Reader won't print TrueType fonts In-Reply-To: <20090415143248.GI24573@bridge> References: <20090414171944.GD13704@bridge> <49E5AB48.5080702@chamonix.reportlab.co.uk> <20090415143248.GI24573@bridge> Message-ID: <051D5863-86E9-4471-8DF3-2CEFD5F60A6B@gmail.com> It failed to print on Acrobat Reader 9 on my MacBook Pro and Mac Pro. Both are running Mac OS 10.5.6. -- Aaron On Apr 15, 2009, at 8:32 AM, Culley Harrelson wrote: > It works with reader 7 on OSX and document viewer on OSX too. Must > be an > Acrobat 8 problem. > > On Wed, 15 Apr 2009, Robin Becker wrote: > >> Hi, I tried this with acrobat reader 7.0 in windoze XP and it >> prints just >> fine. My colleague tried in Adobe Reader 8 in Xubuntu (Hardy AMD >> 64) and >> that fails to print, however, with evince 2.22.2 it does print on his >> machine. I have tried on my 32 bit Jaunty beta and there the document >> prints in evince 2.26.0, but not in acrobat 8. >> >> So mixed results. >> >> >> Culley Harrelson wrote: >>> The attached document is printable with Document Viewer (Gnome) >>> but it will >>> not print with Adobe Reader. The font is Cyberbit. When the font >>> is changed >>> to a built-in font Adobe Reader will print. I have also tried >>> Arial Unicode >>> (TrueType) and Adobe Reader also fails to print. What can I do to >>> get Adobe >>> Reader to print docs with embedded TrueType fonts? Could this be >>> a coding >>> issue? >>> >>> culley >> ........ >> -- >> Robin Becker >> _______________________________________________ >> reportlab-users mailing list >> reportlab-users at reportlab.com >> http://two.pairlist.net/mailman/listinfo/reportlab-users > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2427 bytes Desc: not available Url : From bfreeman at appropriatesolutions.com Wed Apr 15 13:28:35 2009 From: bfreeman at appropriatesolutions.com (Bill Freeman) Date: Wed, 15 Apr 2009 13:28:35 -0400 Subject: [reportlab-users] Wrong kind of slash in doc string cause error in tests-preinstall Message-ID: <49E61943.4030608@appropriatesolutions.com> Feeling unusually dutiful, I read INSTALL.txt when install from the 2.3 tar I downloaded yesterday, and actually ran: python setup.py tests.-preinstall This gets one error, which I eventually tracked down to: In the doc string of src/reportlab/lib/rparsexml.py, on line 44. If I change to a forward slash: the the test is successful, and reportlab-reference.pdf actually gets built. (It says the tests ran OK though it does still mention "Failed to import renderPM".) Bill From robin at reportlab.com Thu Apr 16 06:59:43 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 16 Apr 2009 11:59:43 +0100 Subject: [reportlab-users] Adobe Reader won't print TrueType fonts In-Reply-To: <20090415143248.GI24573@bridge> References: <20090414171944.GD13704@bridge> <49E5AB48.5080702@chamonix.reportlab.co.uk> <20090415143248.GI24573@bridge> Message-ID: <49E70F9F.7060102@chamonix.reportlab.co.uk> I tried the original test document with Adobe Reader 9.1 on win32 and that prints fine. Interestingly the result of this script #### helloworld.py from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfbase.pdfmetrics import registerFont from reportlab.pdfgen.canvas import Canvas registerFont(TTFont("Vera", "Vera.ttf")) registerFont(TTFont("VeraBI", "VeraBI.ttf")) c = Canvas('helloworld.pdf') c.setFont('Vera', 10) c.drawString(100, 700, u'Hello World \xbf\xbe\xe8') c.save() works fine on jaunty with acroread 8, but evince fails with "can't prompt for authorization". I have updated jaunty since the previous attempts so perhaps something else is going on. My colleague is able to print in evince and in acroread 8 with Xubuntu AMD 64. -- Robin Becker From robin at reportlab.com Thu Apr 16 09:35:14 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 16 Apr 2009 14:35:14 +0100 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49E59E9C.9080501@srz.de> References: <49E499EF.6080007@srz.de> <49E4A279.4040106@chamonix.reportlab.co.uk> <49E59E9C.9080501@srz.de> Message-ID: <49E73412.2040303@chamonix.reportlab.co.uk> Yves, if you cannot use the broken fragline stuff to locate the position where the text should be ended then you'll need to brute force the search. A good approach uses a binary search to determine where the split should occur eg from reportlab.pdfbase.pdfmetrics import stringWidth def locateSplit(s,maxWidth,fontName='Times-Roman',fontSize=12): def width(i,L=(len(s)+1)*[None]): if L[i] is None: L[i]=stringWidth(s[:i],fontName,fontSize) return L[i] def brak(lo,hi): i = (lo+hi)>>1 print lo,hi,i,width(i) if lo==i: return lo if width(i)>=maxWidth: return brak(lo,i) else: return brak(i,hi) i=brak(0,len(s)) if width(i)>maxWidth: i-=1 return i, width(i),width(i+1),s[:i] s='Hello Brave World and Goodbye' print locateSplit(s,72). -- Robin Becker From peter at monicol.co.uk Fri Apr 17 09:57:12 2009 From: peter at monicol.co.uk (Peter Mott) Date: Fri, 17 Apr 2009 14:57:12 +0100 Subject: [reportlab-users] pdfgen and Charts Message-ID: <49E88AB8.90901@monicol.co.uk> I'm using the basic pdfgen package for my project. I'd like - though it is not vital - to create a chart and add it to my canvas. I can add a path p I have created by canvas.drawPath(p) and a textobject t by canvas.drawText(t). I can create a rectangle r from the graphics package - but cannot find out how to add it to the canvas. Can this be done? Seems a silly question - but I am new to ReportLab and Googlinf all over has not helped! Thanks, Peter From ken at kencorey.com Fri Apr 17 10:01:30 2009 From: ken at kencorey.com (Ken Corey) Date: Fri, 17 Apr 2009 15:01:30 +0100 Subject: [reportlab-users] Combining reportlab's PDF and pypdf to partially create, partially copy? Message-ID: <49E88BBA.5000707@kencorey.com> Hi All, I'm aiming to generate (on Google AppEngine in Python) a single PDF document made up of some sections created programatically, while others are existing PDF files on disk. So, I tried a little function: ------------------------------------------- class GetPDFPage(AllPages): def get(self): self.response.headers['Content-Type'] = 'application/pdf' p = Canvas(self.response.out) p.drawString(100, 750, "Hey, it's easy!.") p.showPage() p.save() ------------------------------------------- It worked a treat! So then I tried this: ------------------------------------------- class GetPDFPage(AllPages): def get(self): self.response.headers['Content-Type'] = 'application/pdf' outputPDF = PdfFileWriter() p = Canvas(self.response.out) p.drawString(100, 750, "Hey, it's easy!.") p.showPage() p.save() pdfList = glob.glob( '*.pdf') for chapPdf in pdfList: pdfInput = PdfFileReader(file(chapPdf, "rb")) for i in xrange(pdfInput.getNumPages()): outputPDF.addPage(pdfInput.getPage(i)) outputPDF.write(self.response.out) ------------------------------------------- But the funny thing is that the output was *only* the files loaded from the disk, and the stuff generated by Canvas wasn't there at all. Anyone know why? Anyone know how to get around it so that I can crate a page using reportlabs, and then a few pages from existing PDF files, and then generate some more pages, and so on? Thanks! -Ken From robin at reportlab.com Fri Apr 17 10:16:57 2009 From: robin at reportlab.com (Robin Becker) Date: Fri, 17 Apr 2009 15:16:57 +0100 Subject: [reportlab-users] pdfgen and Charts In-Reply-To: <49E88AB8.90901@monicol.co.uk> References: <49E88AB8.90901@monicol.co.uk> Message-ID: <49E88F59.9080807@chamonix.reportlab.co.uk> Peter Mott wrote: > I'm using the basic pdfgen package for my project. I'd like - though it > is not vital - to create a chart and add it to my canvas. I can add a > path p I have created by canvas.drawPath(p) and a textobject t by > canvas.drawText(t). I can create a rectangle r from the graphics package > - but cannot find out how to add it to the canvas. Can this be done? > > Seems a silly question - but I am new to ReportLab and Googlinf all over > has not helped! > > Thanks, > > Peter ....... The canvas already has rectangle/circle etc etc as primitives. The relationship of the graphics classes to the standard canvas is a bit strange. Graphics Drawings are made up of primitive shapes as defined in the shapes.py module. A drawing is also a flowable so it can be included fairly directly into a platypus story. There are chart classes already which can be made into drawings fairly easily. If you find a chart that you like; add to a drawing and you have something that fits easily into a story. It's a bit harder to make flowables draw themselves onto a canvas, but usually you need to use the wrapOn and drawOn methods to do that using code like this... f=Chart(....) w,h = f.wrapOn(canv,availWidth,availHeight) f.drawOn(canv,x,y) If you just wish to draw a simple line chart etc etc then the canvas primitives should allow you to do it. -- Robin Becker From andy at reportlab.com Fri Apr 17 10:17:06 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 17 Apr 2009 15:17:06 +0100 Subject: [reportlab-users] pdfgen and Charts In-Reply-To: <49E88AB8.90901@monicol.co.uk> References: <49E88AB8.90901@monicol.co.uk> Message-ID: <956003ae0904170717j49f681a1w597d6ec0de0d9198@mail.gmail.com> 2009/4/17 Peter Mott : > I'm using the basic pdfgen package for my project. I'd like - though it is > not vital - to create a chart and add it to my canvas. ?I can add a path p I > have created by canvas.drawPath(p) and a textobject t by canvas.drawText(t). > I can create a rectangle r from the graphics package - but cannot find out > how to add it to the canvas. Can this be done? > Have you checked out the reportlab/graphics subpackage? There is a charts library documented in chapter 11 of our userguide, and a separate reference document. Most of the examples make a standalone PDF file for each chart, but each Drawing object is also a Flowable and can thus draw itself on a canvas. If you have a distro without the docs, manuals are here.... http://www.reportlab.com/docs/reportlab-userguide.pdf http://www.reportlab.com/docs/reportlab-graphics-reference.pdf Assuming you already have a canvas object, you can construct a Drawing, add one or more Charts and other shapes to it, then either tell it to draw itself on the canvas, or add it to the story to be flowed into a Platypus document... from reportlab.graphics.shapes import Drawing from reportlab.graphics.charts.barcharts import VerticalBarChart drawing = Drawing(400, 200) data = [ (13, 5, 20, 22, 37, 45, 19, 4), (14, 6, 21, 23, 38, 46, 20, 5) ] bc = VerticalBarChart() bc.x = 50 bc.y = 50 bc.height = 125 bc.width = 300 bc.data = data drawing.add(bc) .... Now draw it like this... drawing.drawOn(myCanvas, x, y) ... or, if you are making a flowing document with Platypus, just add the Drawing to the story./ Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From andy at reportlab.com Fri Apr 17 10:26:09 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 17 Apr 2009 15:26:09 +0100 Subject: [reportlab-users] Combining reportlab's PDF and pypdf to partially create, partially copy? In-Reply-To: <49E88BBA.5000707@kencorey.com> References: <49E88BBA.5000707@kencorey.com> Message-ID: <956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> 2009/4/17 Ken Corey : > But the funny thing is that the output was *only* the files loaded from the > disk, and the stuff generated by Canvas wasn't there at all. > > Anyone know why? ?Anyone know how to get around it so that I can crate a > page using reportlabs, and then a few pages from existing PDF files, and > then generate some more pages, and so on? I don't know pypdf, but I am pretty sure you can't mix it in this way. You would have to generate the new one from reportlab, save it to disk, and then let pypdf combine that file with the pre-existing ones. PDF has lots of binary cross-references within the file so it is more complex than just spitting out pages in order. The 'save()' basically says ReportLab is finished and writes out the PDF document to the output device. So you probably sent out two separate PDF "files" in the same request, and Acrobat Reader (or whatever opens it) is only looking at the latter one. If you can capture what you generated into a file and open it with an editor, you'll probably see two distinct files. They begin with "%%PDF-1.3" or some version number and end with "EOF". - Andy From andy at reportlab.com Fri Apr 17 10:30:35 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 17 Apr 2009 15:30:35 +0100 Subject: [reportlab-users] Wrong kind of slash in doc string cause error in tests-preinstall In-Reply-To: <49E61943.4030608@appropriatesolutions.com> References: <49E61943.4030608@appropriatesolutions.com> Message-ID: <956003ae0904170730r61d6dc27x95975f26387692ea@mail.gmail.com> 2009/4/15 Bill Freeman : > This gets one error, which I eventually tracked down to: > ? > If I change to a forward slash: > ? > Thanks for this! I have fixed the docstring. I guess we missed this as most of us have a better C-based parser (pyRXP) installed, and rparsexml is only used as a fallback. There are various optional C extensions and the renderPM message is correctly saying that you don't have that extension installed yet, so certain tests are not worth running. This is normal for a preinstall test. If during the full install that extension gets compiled, then a 'postinstall' test would import it and generate some bitmap charts without complaining/ Best Regards, -- Andy Robinson CEO/Chief Architect ReportLab Europe Ltd. Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK Tel +44-20-8545-1570 From ken at kencorey.com Fri Apr 17 10:34:50 2009 From: ken at kencorey.com (Ken Corey) Date: Fri, 17 Apr 2009 15:34:50 +0100 Subject: [reportlab-users] Combining reportlab's PDF and pypdf to partially create, partially copy? In-Reply-To: <956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> References: <49E88BBA.5000707@kencorey.com> <956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> Message-ID: <49E8938A.5020104@kencorey.com> Andy Robinson wrote: > I don't know pypdf, but I am pretty sure you can't mix it in this way. > You would have to generate the new one from reportlab, save it to > disk, and then let pypdf combine that file with the pre-existing ones. > PDF has lots of binary cross-references within the file so it is > more complex than just spitting out pages in order. > > The 'save()' basically says ReportLab is finished and writes out the > PDF document to the output device. So you probably sent out two > separate PDF "files" in the same request, and Acrobat Reader (or > whatever opens it) is only looking at the latter one. If you can > capture what you generated into a file and open it with an editor, > you'll probably see two distinct files. They begin with "%%PDF-1.3" > or some version number and end with "EOF". > Wow! Quick response. Well done! You're right about the doubled document. After sending that email, I editted the PDF file using vim and sure enough, the first document was in the first part with 9 sections, and the second document had 16. I was afraid people would say "It's not possible". Rats. I was trying to get lazy, build up the table of contents programmatically, and then just include each further section without any further ado. I guess I'll have to build the whole document programmatically and give up on pypdf. I'd better brew up a fresh pot of tea! Thanks. -Ken From yroman-reportlab at altalang.com Fri Apr 17 11:01:17 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Fri, 17 Apr 2009 11:01:17 -0400 Subject: [reportlab-users] Combining reportlab's PDF and pypdf to partially create, partially copy? In-Reply-To: <49E8938A.5020104@kencorey.com> References: <49E88BBA.5000707@kencorey.com><956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> <49E8938A.5020104@kencorey.com> Message-ID: <005501c9bf6d$5c676430$0502000a@ad.altalang.com> > I was afraid people would say "It's not possible". Rats. I was > trying to get lazy, build up the table of contents programmatically, > and then just include each further section without any further ado. > I guess I'll have to build the whole document programmatically and > give up on pypdf. We've used pyPdf to merge ReportLab's output with pre-existing PDFs without saving anything to disk by just using a StringIO buffer as a temporary destination for ReportLab's output. Taking your example: class GetPDFPage(AllPages): def get(self): self.response.headers['Content-Type'] = 'application/pdf' outputPDF = PdfFileWriter() report_buffer = cStringIO.StringIO() p = Canvas(report_buffer) p.drawString(100, 750, "Hey, it's easy!.") p.save() pdfInput = PdfFileReader(cStringIO.StringIO(report_buffer.getvalue())) outputPDF.addPage(pdfInput.getPage(0)) report_buffer.close() pdfList = glob.glob( '*.pdf') for chapPdf in pdfList: pdfInput = PdfFileReader(file(chapPdf, "rb")) for i in xrange(pdfInput.getNumPages()): outputPDF.addPage(pdfInput.getPage(i)) outputPDF.write(self.response.out) I haven't tested this, but that's the basic gist of what we do. HTH, -- Yoann Roman From andy at reportlab.com Fri Apr 17 11:07:00 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 17 Apr 2009 16:07:00 +0100 Subject: [reportlab-users] Combining reportlab's PDF and pypdf to partially create, partially copy? In-Reply-To: <005501c9bf6d$5c676430$0502000a@ad.altalang.com> References: <49E88BBA.5000707@kencorey.com> <956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> <49E8938A.5020104@kencorey.com> <005501c9bf6d$5c676430$0502000a@ad.altalang.com> Message-ID: <956003ae0904170807l385f3479y1c6b46a3cc1d74e7@mail.gmail.com> 2009/4/17 Yoann Roman : > We've used pyPdf to merge ReportLab's output with pre-existing PDFs > without saving anything to disk by just using a StringIO buffer as a > temporary destination for ReportLab's output. Yes, that would work too. However, I would not expect a big performance gain from doing it in memory rather than on disk. Making and parsing PDF files are both quite heavy jobs, and switching from a few disk-read-writes to memory-read-writes is unlikely to make much difference. Doing it in memory can often reduce disk clutter or the number of configuration options. - Andy From jfabiani at yolo.com Fri Apr 17 11:15:13 2009 From: jfabiani at yolo.com (johnf) Date: Fri, 17 Apr 2009 08:15:13 -0700 Subject: [reportlab-users] paragraphs over several pages Message-ID: <200904170815.13651.jfabiani@yolo.com> I'm hoping someone can explain the general way to handle printing a large body of text (a notes field from a database) across several pages. I am creating an invoice that of course contains headers, footers, groupings and a detail section. In the detail section I have to include a notes field that is unknow in size in advance. In fact it can be quite large for the area assigned and would require several pages to print correctly. This meaning I need to reprint headers, footers, and continue the notes on several pages. I'm sure this has situation has happened to others and I'm interested in how it was handled. -- John Fabiani From yroman-reportlab at altalang.com Fri Apr 17 11:20:30 2009 From: yroman-reportlab at altalang.com (Yoann Roman) Date: Fri, 17 Apr 2009 11:20:30 -0400 Subject: [reportlab-users] Combining reportlab's PDF and pypdf topartially create, partially copy? In-Reply-To: <956003ae0904170807l385f3479y1c6b46a3cc1d74e7@mail.gmail.com> References: <49E88BBA.5000707@kencorey.com><956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com><49E8938A.5020104@kencorey.com><005501c9bf6d$5c676430$0502000a@ad.altalang.com> <956003ae0904170807l385f3479y1c6b46a3cc1d74e7@mail.gmail.com> Message-ID: <005601c9bf70$0b9a3e30$0502000a@ad.altalang.com> > However, I would not expect a big performance gain from doing it in > memory rather than on disk. Making and parsing PDF files are both > quite heavy jobs, and switching from a few disk-read-writes to > memory-read-writes is unlikely to make much difference. Doing it in > memory can often reduce disk clutter or the number of configuration > options. Having never played with Google App Engine, I just assumed they didn't provide access to a temp folder based on Ken's previous response. -- Yoann Roman From andy at reportlab.com Fri Apr 17 11:32:22 2009 From: andy at reportlab.com (Andy Robinson) Date: Fri, 17 Apr 2009 16:32:22 +0100 Subject: [reportlab-users] paragraphs over several pages In-Reply-To: <200904170815.13651.jfabiani@yolo.com> References: <200904170815.13651.jfabiani@yolo.com> Message-ID: <956003ae0904170832q621e5e88ifcfa03e051fdebc7@mail.gmail.com> 2009/4/17 johnf : > I'm hoping someone can explain the general way to handle printing a large body > of text (a notes field from a database) across several pages. ?I am creating > an invoice that of course contains headers, footers, groupings and a detail > section. ?In the detail section I have to include a notes field that is > unknow in size in advance. ?In fact it can be quite large for the area > assigned and would require several pages to print correctly. ?This meaning I > need to reprint headers, footers, and continue the notes on several pages. > I'm sure this has situation has happened to others and I'm interested in how > it was handled. Have you just been using pdfgen so far, or have you tried platypus yet? If not, you should - it's the subpackage dealing with flowing text over multiple pages, and any headers and footers defined in the page templates will repeat themselves. - Andy From ken at kencorey.com Fri Apr 17 12:58:07 2009 From: ken at kencorey.com (Ken Corey) Date: Fri, 17 Apr 2009 17:58:07 +0100 Subject: [reportlab-users] Combining reportlab's PDF and pypdf topartially create, partially copy? In-Reply-To: <005601c9bf70$0b9a3e30$0502000a@ad.altalang.com> References: <49E88BBA.5000707@kencorey.com><956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com><49E8938A.5020104@kencorey.com><005501c9bf6d$5c676430$0502000a@ad.altalang.com> <956003ae0904170807l385f3479y1c6b46a3cc1d74e7@mail.gmail.com> <005601c9bf70$0b9a3e30$0502000a@ad.altalang.com> Message-ID: <49E8B51F.5080602@kencorey.com> Yoann Roman wrote: >> However, I would not expect a big performance gain from doing it in >> memory rather than on disk. Making and parsing PDF files are both >> quite heavy jobs, and switching from a few disk-read-writes to >> memory-read-writes is unlikely to make much difference. Doing it in >> memory can often reduce disk clutter or the number of configuration >> options. >> > > Having never played with Google App Engine, I just assumed they didn't > provide access to a temp folder based on Ken's previous response. > > Yep, that's the gist of it. You're not allowed to write files to disk. This cStringIO thing is way sexy when viewed with the AppEngine's restrictions in mind! Cool, thank you! -Ken From peter at monicol.co.uk Fri Apr 17 15:48:36 2009 From: peter at monicol.co.uk (Peter Mott) Date: Fri, 17 Apr 2009 20:48:36 +0100 Subject: [reportlab-users] pdfgen and Charts In-Reply-To: References: Message-ID: <49E8DD14.8080506@monicol.co.uk> Thank you! c = Canvas("draw.pdf") d = shapes.Drawing(600,300) r = shapes.Rect(0, 0, 400, 200, 20, 20) ... d.add(r) d.drawOn(c, 100, 100) c.save() I do have the docs, but I had got lost in them. What I was looking for was like " c.add(d, 100,100)" instead of d.drawOn(c, 100, 100). and that threw me. Reportlab is great and it is amazing that you make it available to folk for free and then help them when they get stuck. Peter From srichter at cosmos.phy.tufts.edu Sat Apr 18 22:54:56 2009 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Sat, 18 Apr 2009 19:54:56 -0700 Subject: [reportlab-users] =?iso-8859-1?q?Combining_reportlab=27s_PDF_and_?= =?iso-8859-1?q?pypdf_to=09partially_create=2C_partially_copy=3F?= In-Reply-To: <49E8938A.5020104@kencorey.com> References: <49E88BBA.5000707@kencorey.com> <956003ae0904170726s73361b31k403709f6c17f22a5@mail.gmail.com> <49E8938A.5020104@kencorey.com> Message-ID: <200904181954.57013.srichter@cosmos.phy.tufts.edu> On Friday 17 April 2009, Ken Corey wrote: > I was afraid people would say "It's not possible". ?Rats. ?I was trying > to get lazy, build up the table of contents programmatically, and then > just include each further section without any further ado. ?I guess I'll > have to build the whole document programmatically and give up on pypdf. Have a look at z3c.rml. It combines Reportlab and pypdf, but doing it the proper way Andy suggested. Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. "Zope Stephan Richter" From ken at kencorey.com Sun Apr 19 16:59:48 2009 From: ken at kencorey.com (Ken Corey) Date: Sun, 19 Apr 2009 21:59:48 +0100 Subject: [reportlab-users] Template examples? Message-ID: <49EB90C4.7050401@kencorey.com> The document I'm interested in creating has several types of page: First page, general body page, section start page, appendix start page, appendix body page...and probably others that I don't yet know about. I saw the Hello World example for SimpleDocTemplate that creates 100 paragraphs in the document, and has a separate handler for the first page than from the rest of the pages. I can see how I could subclass BaseDocTemplate, and perhaps add special pages for each situation (though I'm fuzzy how I would specify that page 6 is regular, page 7 is section start, page 8-12 is general body, page 13 is section start again, etc.) If anyone has any template classes like this that they'd care to share, I've got *lots* to learn (just ask my wife...:^) Anyway, I also saw on a web page (http://achievewith.us/public/articles/2007/02/21/produce-pdf-pages-with-turbogears-cheetah-and-reportlab) a tantalising discussion about a template built using a Cheetah templating tool like so: some text... Has anyone tried mixing reportlabs' PDF tool's templates and Cheetah templates? Any thoughts on whether this would make it easier or harder than reportlab's templates only? -Ken From Y.Forkl at srz.de Mon Apr 20 07:28:09 2009 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon, 20 Apr 2009 13:28:09 +0200 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49E73412.2040303@chamonix.reportlab.co.uk> References: <49E499EF.6080007@srz.de> <49E4A279.4040106@chamonix.reportlab.co.uk> <49E59E9C.9080501@srz.de> <49E73412.2040303@chamonix.reportlab.co.uk> Message-ID: <49EC5C49.5080207@srz.de> Robin Becker schrieb: > > if you cannot use the broken fragline stuff to locate the position where > the text should be ended then you'll need to brute force the search. A > good approach uses a binary search to determine where the split should > occur eg [...] Thank you for the function locateSplit you proposed. In the meantime, I had come up with a function that follows very much the same line of thought (but shortens and appends the ellipsis as well): def fitIntoTableCell(content, columnWidth, fontName, fontSize): _c = canvas.Canvas('nofile.pdf') # reduce actual column width a bit, to account for padding etc. columnWidth -= 5 contentWidth = _c.stringWidth(content, fontName, fontSize) shortened = False # if the content is wider than the cell, cut off enough from it so # that the ellipsis fits in, too if contentWidth > columnWidth: shortened = True # take width of ellipsis into account; empirically determined # with fontName == Helvetica and fontSize == 12 (should # rather be calaculated from these parameters) columnWidthBeforeEllipsis = columnWidth - 7 while contentWidth > columnWidthBeforeEllipsis: # cutting by single characters because words might be too # long content = content[:-1] contentWidth = _c.stringWidth(content, fontName, fontSize) del _c if shortened: content += u'\u2026' return content I wonder how I could do without the dummy canvas, though... Yves From robin at reportlab.com Mon Apr 20 08:51:04 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 20 Apr 2009 13:51:04 +0100 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49EC5C49.5080207@srz.de> References: <49E499EF.6080007@srz.de> <49E4A279.4040106@chamonix.reportlab.co.uk> <49E59E9C.9080501@srz.de> <49E73412.2040303@chamonix.reportlab.co.uk> <49EC5C49.5080207@srz.de> Message-ID: <49EC6FB8.2010205@chamonix.reportlab.co.uk> Yves Forkl wrote: > Robin Becker schrieb: >> >> if you cannot use the broken fragline stuff to locate the position >> where the text should be ended then you'll need to brute force the >> search. A good approach uses a binary search to determine where the >> split should occur eg [...] > > Thank you for the function locateSplit you proposed. In the meantime, I > had come up with a function that follows very much the same line of > thought (but shortens and appends the ellipsis as well): > > def fitIntoTableCell(content, columnWidth, fontName, fontSize): > _c = canvas.Canvas('nofile.pdf') > # reduce actual column width a bit, to account for padding etc. > columnWidth -= 5 > contentWidth = _c.stringWidth(content, fontName, fontSize) > shortened = False > # if the content is wider than the cell, cut off enough from it so > # that the ellipsis fits in, too > if contentWidth > columnWidth: > shortened = True > # take width of ellipsis into account; empirically determined > # with fontName == Helvetica and fontSize == 12 (should > # rather be calaculated from these parameters) > columnWidthBeforeEllipsis = columnWidth - 7 > while contentWidth > columnWidthBeforeEllipsis: > # cutting by single characters because words might be too > # long > content = content[:-1] > contentWidth = _c.stringWidth(content, fontName, fontSize) > del _c > if shortened: > content += u'\u2026' > return content > > I wonder how I could do without the dummy canvas, though... > > Yves ........ you can import stringWidth directly eg from reportlab.pdfbase.pdfmetrics import stringWidth then change _c.stringWidth to stringWidth -- Robin Becker From Y.Forkl at srz.de Mon Apr 20 09:08:28 2009 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon, 20 Apr 2009 15:08:28 +0200 Subject: [reportlab-users] Truncate table cell content to end with ellipsis In-Reply-To: <49EC6FB8.2010205@chamonix.reportlab.co.uk> References: <49E499EF.6080007@srz.de> <49E4A279.4040106@chamonix.reportlab.co.uk> <49E59E9C.9080501@srz.de> <49E73412.2040303@chamonix.reportlab.co.uk> <49EC5C49.5080207@srz.de> <49EC6FB8.2010205@chamonix.reportlab.co.uk> Message-ID: <49EC73CC.90806@srz.de> Robin Becker schrieb: > Yves Forkl wrote: >> >> I wonder how I could do without the dummy canvas, though... > you can import stringWidth directly eg > > from reportlab.pdfbase.pdfmetrics import stringWidth > > then change _c.stringWidth to stringWidth D'oh! If I had have taken one more look to your function code, I could have figured out myself. Thank you anyway. Yves From bfreeman at appropriatesolutions.com Mon Apr 20 09:40:24 2009 From: bfreeman at appropriatesolutions.com (Bill Freeman) Date: Mon, 20 Apr 2009 09:40:24 -0400 Subject: [reportlab-users] Wrong kind of slash in doc string cause error in tests-preinstall In-Reply-To: <956003ae0904170730r61d6dc27x95975f26387692ea@mail.gmail.com> References: <49E61943.4030608@appropriatesolutions.com> <956003ae0904170730r61d6dc27x95975f26387692ea@mail.gmail.com> Message-ID: <49EC7B48.5030801@appropriatesolutions.com> Andy Robinson wrote: > 2009/4/15 Bill Freeman : > >> This gets one error, which I eventually tracked down to: >> >> If I change to a forward slash: >> >> >> > > Thanks for this! I have fixed the docstring. I guess > we missed this as most of us have a better C-based parser > (pyRXP) installed, and rparsexml is only used as a fallback. > Hmmm. I wonder if failure to complain about reverse solidus not part of a quoted attribute value is really an improvement. I guess fast and strict will often be at odds with on another. By the way, I've collected a few documentation nits over the weekend. Should I just post diffs here, or is there a more appropriate submission mechanism? Bill From andy at reportlab.com Mon Apr 20 09:49:30 2009 From: andy at reportlab.com (Andy Robinson) Date: Mon, 20 Apr 2009 14:49:30 +0100 Subject: [reportlab-users] Wrong kind of slash in doc string cause error in tests-preinstall In-Reply-To: <49EC7B48.5030801@appropriatesolutions.com> References: <49E61943.4030608@appropriatesolutions.com> <956003ae0904170730r61d6dc27x95975f26387692ea@mail.gmail.com> <49EC7B48.5030801@appropriatesolutions.com> Message-ID: <956003ae0904200649v23c3d419t2a3d1c78be204e36@mail.gmail.com> 2009/4/20 Bill Freeman : > Hmmm. ?I wonder if failure to complain about reverse solidus not part of a > quoted attribute value is really an improvement. ?I guess fast and strict > will often be at odds with on another. We have a fast-and-crude parser in our library for intra-paragraph markup, built in 2000 when the state of XML parsing in Python sucked. We also have a fairly ugly way to make a manual by extracting docstrings and turning them to blocks of markup; I don't regard this manual generation as part of the library and do not see much point trying to make it more robust, as we'd do it differently (Sphinx?) if redoing it today. So in this case I just fixed the bad input instead of generalising the parser. The parser will still complain if anyone does inside a paragraph of their own. > By the way, I've collected a few documentation nits over the weekend. > ?Should I just post diffs here, or is there a more appropriate submission > mechanism? Post them here please. We would love more documentation patches. - Andy From ken at kencorey.com Mon Apr 20 12:03:30 2009 From: ken at kencorey.com (Ken Corey) Date: Mon, 20 Apr 2009 17:03:30 +0100 Subject: [reportlab-users] PDF creation, z3c.rml and TOCs... Message-ID: <49EC9CD2.2030902@kencorey.com> Hi All, I've spent a very interesting day reading through the documentation regarding z3c.rml, (and the rml examples from reportlab once I found them), and then trying to get z3c.rml working standalone. I checked out z3c.rml, Zope, zope.event, zope.i18nmessageid, zope.interface, zope.schema. I changed all the references to lxml to xml.etree.ElementTree, so that it might work on Google AppEngine. I set up pythonpath to point the the (seemingly) appropriate places, and then tried several times running rml2pdf.py with this command line: C:\Temp\z3c.rml\src\z3c\rml>python rml2pdf.py tests\input\simple-layout.rml Traceback (most recent call last): File "rml2pdf.py", line 25, in import document, interfaces File "C:\Temp\z3c.rml\src\z3c\rml\document.py", line 26, in from z3c.rml import attr, directive, interfaces, occurence File "c:\temp\z3c.rml\src\z3c\rml\attr.py", line 36, in from z3c.rml import interfaces File "c:\temp\z3c.rml\src\z3c\rml\interfaces.py", line 138, in class IDeprecatedDirective(zope.interface.interfaces.IInterface): AttributeError: 'module' object has no attribute 'interfaces' Do you know what that error means? All this 'Interface' stuff has me more than a little bemused as a complete Python newbie. Thanks for any help you can give... -Ken From ken at kencorey.com Wed Apr 22 12:54:57 2009 From: ken at kencorey.com (Ken Corey) Date: Wed, 22 Apr 2009 17:54:57 +0100 Subject: [reportlab-users] Attempting to use z3c.rml properly... Message-ID: <49EF4BE1.2080305@kencorey.com> Hi All, I've given up on using z3c.rml (or indeed reportab's open-source software) with Google's AppEngine as the restrictions they were too constraining. Now, I just want to be able to run z3c.rml on my machine at home to verify how it works. So, starting with a clean z3c.rml 0.8.1: Installing onto a XP Pro SP3 machine, Python 2.5 with setuptools. I did a 'python setup.py install' for zope.event, zope.interface, zope.schema, and zope.i18nmessageid first. Everything except zope.i18nmessageid went well. Then, I did the same for z3c.rml. It pulled in all the dependancies (downloaded lxml 2.2, and checked zope.schema 3.5.5, zope.interface 3.5.2, reportlab 2.3, pyPdf 1.12). Okay, now what? How best to launch this? If I cd into C:\Temp\z3c.rml\src\z3c\rml, and give this command line: python rml2pdf.py tests\input\simple-layout.rml I get this error: Traceback (most recent call last): File "rml2pdf.py", line 24, in from z3c.rml import document, interfaces File "c:\python25\lib\site-packages\z3c.rml-0.8.1dev-py2.5.egg\z3c\rml\document.py", line 26, in from z3c.rml import attr, directive, interfaces, occurence File "c:\python25\lib\site-packages\z3c.rml-0.8.1dev-py2.5.egg\z3c\rml\attr.py", line 35, in from z3c.rml import interfaces File "c:\python25\lib\site-packages\z3c.rml-0.8.1dev-py2.5.egg\z3c\rml\interfaces.py", line 138, in class IDeprecatedDirective(zope.interface.interfaces.IInterface): AttributeError: 'module' object has no attribute 'interfaces' If I cd into the 'tests' directory, and try this: python text_rml.py I get almost the same traceback (just with 'text_rml.py' replacing 'rml2pdf.py'). Am I trying to run this correctly? I'd put money on my doing something ham-fisted here, but I can't see what it is. Just for context, it'd be hard to underestimate my experience with Python. I've only been at this a week or so, and figuring out things as I go, so please don't worry about hurting my feeling by going too simple! Thanks for any help. -Ken From e.katagiri at teikokupr.co.jp Thu Apr 23 22:39:42 2009 From: e.katagiri at teikokupr.co.jp (katagiri) Date: Fri, 24 Apr 2009 11:39:42 +0900 Subject: [reportlab-users] I got an error at "python setup.py tests-preinstall" Message-ID: <20090424113552.B5FF.7E4E9441@teikokupr.co.jp> Hi [katagiri at dev02 ReportLab_2_3]$ python setup.py tests-preinstall ........................................................................................................Traceback (most recent call last): File "genreference.py", line 31, in run() File "genreference.py", line 17, in run yaml2pdf.run('reference.yml','reportlab-reference.pdf') File "/opensrc/ReportLab_2_3/tools/docco/yaml2pdf.py", line 54, in run story.append(Paragraph(text, style, bulletText=bulletText)) File "/opensrc/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 798, in __init__ self._setup(text, style, bulletText, frags, cleanBlockQuotedText) File "/opensrc/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 816, in _setup % (_parser.errors[0],text[:min(30,len(text))])) ValueError: xml parser error (garbage in start tag) in paragraph beginning 'Very simple and fast XML parse' Failed to import renderPM. F............................................................................. ====================================================================== FAIL: Test if all manuals buildable from source. ---------------------------------------------------------------------- Traceback (most recent call last): File "/opensrc/ReportLab_2_3/tests/test_docs_build.py", line 32, in test0 assert os.path.isfile('reportlab-reference.pdf'), 'genAll.py failed to generate reportlab-reference.pdf!' AssertionError: genAll.py failed to generate reportlab-reference.pdf! ---------------------------------------------------------------------- Ran 182 tests in 68.544s FAILED (failures=1) ----------------------------------------------------------------------- thanks for your any help. From e.katagiri at teikokupr.co.jp Fri Apr 24 01:24:11 2009 From: e.katagiri at teikokupr.co.jp (katagiri) Date: Fri, 24 Apr 2009 14:24:11 +0900 Subject: [reportlab-users] I got an error at "python setup.py tests-preinstall" In-Reply-To: <20090424113552.B5FF.7E4E9441@teikokupr.co.jp> References: <20090424113552.B5FF.7E4E9441@teikokupr.co.jp> Message-ID: <20090424141928.B605.7E4E9441@teikokupr.co.jp> It's resolved ! I installed the ReportLab toolkit. $ python setup.py build # python setup.py install then $ python setup.py tests-preinstall ...................................................................... ---------------------------------------------------------------------- Ran 193 tests in 49.162s OK On Fri, 24 Apr 2009 11:39:42 +0900 katagiri wrote: > Hi > > [katagiri at dev02 ReportLab_2_3]$ python setup.py tests-preinstall > ........................................................................................................Traceback (most recent call last): > File "genreference.py", line 31, in > run() > File "genreference.py", line 17, in run > yaml2pdf.run('reference.yml','reportlab-reference.pdf') > File "/opensrc/ReportLab_2_3/tools/docco/yaml2pdf.py", line 54, in run > story.append(Paragraph(text, style, bulletText=bulletText)) > File "/opensrc/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 798, in __init__ > self._setup(text, style, bulletText, frags, cleanBlockQuotedText) > File "/opensrc/ReportLab_2_3/src/reportlab/platypus/paragraph.py", line 816, in _setup > % (_parser.errors[0],text[:min(30,len(text))])) > ValueError: xml parser error (garbage in start tag) in paragraph beginning > 'Very simple and fast XML parse' > Failed to import renderPM. > F............................................................................. > ====================================================================== > FAIL: Test if all manuals buildable from source. > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "/opensrc/ReportLab_2_3/tests/test_docs_build.py", line 32, in test0 > assert os.path.isfile('reportlab-reference.pdf'), 'genAll.py failed to generate reportlab-reference.pdf!' > AssertionError: genAll.py failed to generate reportlab-reference.pdf! > > ---------------------------------------------------------------------- > Ran 182 tests in 68.544s > > FAILED (failures=1) > > ----------------------------------------------------------------------- > > thanks for your any help. > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users From sorin.sbarnea at gmail.com Sun Apr 26 04:33:41 2009 From: sorin.sbarnea at gmail.com (Sorin Sbarnea) Date: Sun, 26 Apr 2009 11:33:41 +0300 Subject: [reportlab-users] cannot install reportlab using easy_install Message-ID: I discovered that "easy_install reportlab" fails on Centos, here is the error [root at vm srv]# easy_install reportlab Searching for reportlab Reading http://cheeseshop.python.org/pypi/reportlab/ Reading http://www.reportlab.com/ Reading http://cheeseshop.python.org/pypi/reportlab/2.3 Best match: reportLab 2.3 Downloading http://pypi.python.org/packages/source/r/reportlab/reportLab-2.3.zip#md5=7d98b26fa287a9e4be4d35d682ce64ac Processing reportLab-2.3.zip Running ReportLab_2_3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-NDV26e/ReportLab_2_3/egg-dist-tmp-XgCI0L ################################################ #Attempting install of _rl_accel, sgmlop & pyHnj #extensions from '/tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel' ################################################ ################################################ #Attempting install of _renderPM #extensions from '/tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/renderPM' # installing without freetype no ttf, sorry! ################################################ /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function ?hex32?: /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:793: warning: format ?%8.8X? expects type ?unsigned int?, but argument 5 has type ?long unsigned int? /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: In function ?_instanceStringWidthU?: /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1200: warning: pointer targets in assignment differ in signedness /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: ?f? may be used uninitialized in this function /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: ?t? may be used uninitialized in this function /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: warning: ?L? may be used uninitialized in this function /usr/bin/ld: cannot find -l_renderPM_libart collect2: ld returned 1 exit status error: Setup script exited with error: command 'gcc' failed with exit status 1 -- /sorin http://nusunt.eu From marco.bizzarri at gmail.com Sun Apr 26 05:50:02 2009 From: marco.bizzarri at gmail.com (Marco Bizzarri) Date: Sun, 26 Apr 2009 11:50:02 +0200 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: References: Message-ID: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> On Sun, Apr 26, 2009 at 10:33 AM, Sorin Sbarnea wrote: > I discovered that "easy_install reportlab" fails on Centos, here is the error > > [root at vm srv]# easy_install reportlab > Searching for reportlab > Reading http://cheeseshop.python.org/pypi/reportlab/ > Reading http://www.reportlab.com/ > Reading http://cheeseshop.python.org/pypi/reportlab/2.3 > Best match: reportLab 2.3 > Downloading http://pypi.python.org/packages/source/r/reportlab/reportLab-2.3.zip#md5=7d98b26fa287a9e4be4d35d682ce64ac > Processing reportLab-2.3.zip > Running ReportLab_2_3/setup.py -q bdist_egg --dist-dir > /tmp/easy_install-NDV26e/ReportLab_2_3/egg-dist-tmp-XgCI0L > ################################################ > #Attempting install of _rl_accel, sgmlop & pyHnj > #extensions from '/tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel' > ################################################ > ################################################ > #Attempting install of _renderPM > #extensions from '/tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/renderPM' > # installing without freetype no ttf, sorry! > ################################################ > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: > In function ?hex32?: > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:793: > warning: format ?%8.8X? expects type ?unsigned int?, but argument 5 > has type ?long unsigned int? > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c: > In function ?_instanceStringWidthU?: > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1200: > warning: pointer targets in assignment differ in signedness > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: > warning: ?f? may be used uninitialized in this function > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: > warning: ?t? may be used uninitialized in this function > /tmp/easy_install-NDV26e/ReportLab_2_3/src/rl_addons/rl_accel/_rl_accel.c:1123: > warning: ?L? may be used uninitialized in this function > /usr/bin/ld: cannot find -l_renderPM_libart > collect2: ld returned 1 exit status > error: Setup script exited with error: command 'gcc' failed with exit status 1 > Making a wild guess: your gcc is newer than the one used to check reportlab. The newer version could be more strict than the previous ones. You could post the version of gcc (gcc -v) so that people at reportlab can diagnose the problem more properly. Even though I'm not an expert of easy_install, if you've older versions of gcc installerd, maybe you could try to force it to use an older version using an "export CC=/usr/bin/gcc-"; however, I'm not sure this will not cause troubles with python itself. Again, making guesses. Regards Marco -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ From dave at bcs.co.nz Sun Apr 26 06:19:17 2009 From: dave at bcs.co.nz (David Brooks) Date: Sun, 26 Apr 2009 22:19:17 +1200 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> Message-ID: <49F43525.8050606@bcs.co.nz> You are much better off downloading ReportLab from http://www.reportlab.org/downloads.html and following the instructions in the User Guide -- easy_install is *not* the recommended way to install the package.... Dave On 26/4/09 9:50 PM, Marco Bizzarri wrote: > On Sun, Apr 26, 2009 at 10:33 AM, Sorin Sbarnea wrote: > >> I discovered that "easy_install reportlab" fails on Centos, here is the error >> >> >> >> > > Making a wild guess: your gcc is newer than the one used to check > reportlab. The newer version could be more strict than the previous > ones. > > You could post the version of gcc (gcc -v) so that people at reportlab > can diagnose the problem more properly. > > Even though I'm not an expert of easy_install, if you've older > versions of gcc installerd, maybe you could try to force it to use an > older version using an "export CC=/usr/bin/gcc-"; however, > I'm not sure this will not cause troubles with python itself. Again, > making guesses. > > Regards > Marco > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sorin.sbarnea at gmail.com Sun Apr 26 06:41:02 2009 From: sorin.sbarnea at gmail.com (Sorin Sbarnea) Date: Sun, 26 Apr 2009 13:41:02 +0300 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: <49F43525.8050606@bcs.co.nz> References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> Message-ID: Thanks for the fast response. Here is the gcc version: gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) - from CentOS release 5.3 (Final) Regarding easy_install - this should be a recommended way to install any python package, specially when the distribution does not provide a a package using it's package manager. I know that I could try other methods but I prefer so solve this bug - so others will not have the same issue. BTW, I'm not the first encountering this issue, take a look at: http://mail.python.org/pipermail/python-list/2009-February/702078.html I will be happy to assist in solving this. -- /sorin http://nusunt.eu On Sun, Apr 26, 2009 at 1:19 PM, David Brooks wrote: > You are much better off downloading ReportLab from > http://www.reportlab.org/downloads.html and following the instructions in > the User Guide -- easy_install is *not* the recommended way to install the > package.... > > > Dave > > On 26/4/09 9:50 PM, Marco Bizzarri wrote: > > On Sun, Apr 26, 2009 at 10:33 AM, Sorin Sbarnea > wrote: > > > I discovered that "easy_install reportlab" fails on Centos, here is the > error > > > > > > Making a wild guess: your gcc is newer than the one used to check > reportlab. The newer version could be more strict than the previous > ones. > > You could post the version of gcc (gcc -v) so that people at reportlab > can diagnose the problem more properly. > > Even though I'm not an expert of easy_install, if you've older > versions of gcc installerd, maybe you could try to force it to use an > older version using an "export CC=/usr/bin/gcc-"; however, > I'm not sure this will not cause troubles with python itself. Again, > making guesses. > > Regards > Marco > > > > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > From marius at gedmin.as Sun Apr 26 15:55:03 2009 From: marius at gedmin.as (Marius Gedminas) Date: Sun, 26 Apr 2009 21:55:03 +0200 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> Message-ID: <20090426195503.GC10528@platonas> On Sun, Apr 26, 2009 at 01:41:02PM +0300, Sorin Sbarnea wrote: > Thanks for the fast response. Here is the gcc version: > > gcc version 4.1.2 20080704 (Red Hat 4.1.2-44) - from CentOS release 5.3 (Final) > > Regarding easy_install - this should be a recommended way to install > any python package, specially when the distribution does not provide a > a package using it's package manager. > > I know that I could try other methods but I prefer so solve this bug - > so others will not have the same issue. > > BTW, I'm not the first encountering this issue, take a look at: > http://mail.python.org/pipermail/python-list/2009-February/702078.html > > I will be happy to assist in solving this. I know that people have been re-packaging reportlab so it's easy_install'able. I've been bugging them about sending a patch upstream to fix this once and for all for everyone. See http://ftp.schooltool.org/schooltool/eggs/3.4/Reportlab-2.1.tar.gz The SchoolTool project uses that one with the following buildout.cfg: [buildout] ... find-links = http://ftp.schooltool.org/schooltool/eggs/3.4 ... in other words, I believe that easy_install -f http://ftp.schooltool.org/schooltool/eggs/3.4/ Reportlab ought to work, and comparing that tarball with the official one would provide hints as to what needs to be fixed. (By the way, that command failed to work for me. I'm assuming it's because I'm using python 2.6.) Marius Gedminas -- To stay awake all night adds a day to your life. -- Stilgar (Frank Herbert _Children_of_Dune_) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : From timr at probo.com Mon Apr 27 01:53:40 2009 From: timr at probo.com (timr at probo.com) Date: Sun, 26 Apr 2009 22:53:40 -0700 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: ; from Sorin Sbarnea on Sun, Apr 26, 2009 at 01:41:02PM +0300 References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> Message-ID: <20090426225340.C23063@probo.com> On Sun, Apr 26, 2009 at 01:41:02PM +0300, Sorin Sbarnea wrote: > > Regarding easy_install - this should be a recommended way to install > any python package, specially when the distribution does not provide a > a package using it's package manager. That's your opinion. "easy_install" is simply one way of installing Python packages. It is not the "recommended" way. Unlike Perl and PHP, the Python community has not yet settled on a "recommended" way of installing Python packages. -- Tim Roberts, timr at probo.com Providenza & Boeklheide, Inc. From sorin.sbarnea at gmail.com Mon Apr 27 02:10:17 2009 From: sorin.sbarnea at gmail.com (Sorin Sbarnea) Date: Mon, 27 Apr 2009 09:10:17 +0300 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: <20090426225340.C23063@probo.com> References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> <20090426225340.C23063@probo.com> Message-ID: I think the issue was caused by a very old libart (from 2001) inside renderPM addon. Also I solved the compile warnings inside gt1. Here is the new version http://nusunt.eu/download/ReportLab_2_3_1.tar.gz -- /sorin http://nusunt.eu On Mon, Apr 27, 2009 at 8:53 AM, wrote: > asy_install" is simply one way of installing > Python packages. ?It is not the "recommended" way. ?Unlike Perl and PHP, > the Python community has not From robin at reportlab.com Mon Apr 27 05:28:08 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 27 Apr 2009 10:28:08 +0100 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> <20090426225340.C23063@probo.com> Message-ID: <49F57AA8.7090706@chamonix.reportlab.co.uk> Sorin Sbarnea wrote: > I think the issue was caused by a very old libart (from 2001) inside > renderPM addon. Also I solved the compile warnings inside gt1. > Here is the new version http://nusunt.eu/download/ReportLab_2_3_1.tar.gz ..... I don't think it's a good idea to create new versions of some package if you're not willing to maintain them forever :) If you have indeed fixed everything up to your liking it would be better to post a patch; that could then be applied to the current source and would appear in future releases. -- Robin Becker From sorin.sbarnea at gmail.com Mon Apr 27 05:53:56 2009 From: sorin.sbarnea at gmail.com (Sorin Sbarnea) Date: Mon, 27 Apr 2009 12:53:56 +0300 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: <49F57AA8.7090706@chamonix.reportlab.co.uk> References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> <20090426225340.C23063@probo.com> <49F57AA8.7090706@chamonix.reportlab.co.uk> Message-ID: I did create a patch: http://nusunt.eu/download/libart_and_gt1_update.patch Changes: * updated libart to the latest release * added #include to gt1-namecontext.c -- /sorin http://nusunt.eu On Mon, Apr 27, 2009 at 12:28 PM, Robin Becker wrote: > Sorin Sbarnea wrote: >> >> I think the issue was caused by a very old libart (from 2001) inside >> renderPM addon. Also I solved the compile warnings inside gt1. >> Here is the new version http://nusunt.eu/download/ReportLab_2_3_1.tar.gz > > ..... > I don't think it's a good idea to create new versions of some package if > you're not willing to maintain them forever :) > > If you have indeed fixed everything up to your liking it would be better to > post a patch; that could then be applied to the current source and would > appear in future releases. > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > From arkadi at smartbit.be Mon Apr 27 08:30:18 2009 From: arkadi at smartbit.be (Arkadi Colson) Date: Mon, 27 Apr 2009 14:30:18 +0200 Subject: [reportlab-users] package creation Message-ID: <49F5A55A.6090202@smartbit.be> Hi all, Is there anyone who already has build a debian package for etch with version 2.3 ? Thanks, best regards, Arkadi Colson -- Smartbit bvba Hoogstraat 13 B-3670 Meeuwen T: +32 89 46 81 08 F: +32 89 46 81 10 From robin at reportlab.com Mon Apr 27 08:59:37 2009 From: robin at reportlab.com (Robin Becker) Date: Mon, 27 Apr 2009 13:59:37 +0100 Subject: [reportlab-users] cannot install reportlab using easy_install In-Reply-To: References: <3f0d61c40904260250n772e8635wca3005cc52a2df0f@mail.gmail.com> <49F43525.8050606@bcs.co.nz> <20090426225340.C23063@probo.com> <49F57AA8.7090706@chamonix.reportlab.co.uk> Message-ID: <49F5AC39.9090705@chamonix.reportlab.co.uk> Sorin Sbarnea wrote: > I did create a patch: http://nusunt.eu/download/libart_and_gt1_update.patch > > Changes: > * updated libart to the latest release > * added #include to gt1-namecontext.c > > -- > /sorin > http://nusunt.eu ....... Thanks for the patch, but I'm not sure I want to apply it right now. I do have the latest code, but I don't think I always understand it. eg in art_affine.c - if ((int)floor(x + EPSILON / 2) < 1) + if ((int)floor ((x + EPSILON / 2) < 1)) I don't understand this change at all; the first is reasonable ie is floor(v) less than 1 where v=x + EPSILON / 2; the latter seems to be taking the floor of a boolean expression ie floor(v<1); assuming that boolean expressions map to 0 or 1 then I think the effect is unchanged, but it looks sort of dodgy. This code is used in some sort of postscript output, so probably doesn't hurt us. On the other hand, many of the changes related to int and other casts were probably added by me to eliminate warnings from the win32 compilers. If this stuff is to be fixed probably I ought to try and use the changes from 2.3.12 --> 2.3.20 to adjust our code rather than just blindly use your patch. Apart from any difficulties you had with compilation etc. did you have any specific problem that required updating this library? -- Robin Becker From varlogrun at gmail.com Tue Apr 28 14:04:52 2009 From: varlogrun at gmail.com (Var Logrun) Date: Tue, 28 Apr 2009 11:04:52 -0700 Subject: [reportlab-users] hcfa1500 17A, 17B and 24 update Message-ID: Hello, I'm writing about the hcfa1500.py model contributed here: www.reportlab.org/bauer1.html. The latest form from NUCC http://nucc.org/images/stories/PDF/cms_1500_sample.pdf has different fields from the one hosted at reportlab. Some specific differences: - Field 17 is split into two boxes, 17A and 17B - Field 24 has dropped box K, box I and J are different. I can write and submit a patch with the latest differences, but before that, I wanted to check to see if there was a later version of hcfa1500.py available. Let me know if there's another list I should submit to instead. Thanks, VL From andy at reportlab.com Wed Apr 29 02:27:40 2009 From: andy at reportlab.com (Andy Robinson) Date: Wed, 29 Apr 2009 07:27:40 +0100 Subject: [reportlab-users] hcfa1500 17A, 17B and 24 update In-Reply-To: References: Message-ID: <956003ae0904282327q35cee33xf4ffecb009f24ee3@mail.gmail.com> 2009/4/28 Var Logrun : > Hello, > > I'm writing about the hcfa1500.py model contributed here: > www.reportlab.org/bauer1.html. > > I can write and submit a patch with the latest differences, but before > that, I wanted to check to see if there was a later version of > hcfa1500.py available. I don't think anyone has done anything to this since Jeff submitted it many years ago, and he's in a different line of business now. Please do send in an update.... - Andy From jtk at yahoo.com Wed Apr 29 05:51:29 2009 From: jtk at yahoo.com (Jeff Kowalczyk) Date: Wed, 29 Apr 2009 05:51:29 -0400 Subject: [reportlab-users] hcfa1500 17A, 17B and 24 update References: Message-ID: On Tue, 28 Apr 2009 11:04:52 -0700, Var Logrun wrote: > Hello, > > I'm writing about the hcfa1500.py model contributed here: > www.reportlab.org/bauer1.html. > > The latest form from NUCC > http://nucc.org/images/stories/PDF/cms_1500_sample.pdf has different > fields from the one hosted at reportlab. > > I can write and submit a patch with the latest differences, but before > that, I wanted to check to see if there was a later version of hcfa1500.py > available. + 1 for the patch, it would be greatly appreciated. I suggest renaming the module to cms1500.py, and embedding the specific date-revision "CMS-1500 (08-05)" in a docstring. It's an extremely useful form template on its own merits, and the example's separation of coordinates from code make it easy for someone to get started with RL forms of similar complexity. Jeff From robin at reportlab.com Thu Apr 30 04:57:58 2009 From: robin at reportlab.com (Robin Becker) Date: Thu, 30 Apr 2009 09:57:58 +0100 Subject: [reportlab-users] hcfa1500 17A, 17B and 24 update In-Reply-To: References: Message-ID: <49F96816.30904@chamonix.reportlab.co.uk> Var Logrun wrote: > Hello, > > I'm writing about the hcfa1500.py model contributed here: > www.reportlab.org/bauer1.html. > > The latest form from NUCC > http://nucc.org/images/stories/PDF/cms_1500_sample.pdf has different > fields from the one hosted at reportlab. > > Some specific differences: > > - Field 17 is split into two boxes, 17A and 17B > - Field 24 has dropped box K, box I and J are different. > > I can write and submit a patch with the latest differences, but before > that, I wanted to check to see if there was a later version of > hcfa1500.py available. > > Let me know if there's another list I should submit to instead. > > Thanks, > > VL ....... we certainly don't have a newer one. If you contribute a different version we'll certainly find a way to show it off. -- Robin Becker