From IStevens at globeandmail.com Fri Jul 4 19:49:53 2008 From: IStevens at globeandmail.com (Stevens, Ian) Date: Fri, 4 Jul 2008 19:49:53 -0400 Subject: [reportlab-users] Specifying chart join axis to intersect point does not draw line below that point Message-ID: I need a chart with 2 points on it, with one of the points centered on the chart intersected by two lines, one parallel to each axis. The result ishould be like a crosshair centered in the chart with one point at the center of the crosshair. I've accomplished most of what I need with ScatterPlot: centerPointX = ... centerPointY = ... plot = ScatterPlot() [...] plot.xValueAxis.strokeColor = plot.yValueAxis.strokeColor = colors.white plot.xValueAxis.joinAxisMode = plot.yValueAxis.joinAxisMode = 'value' plot.xValueAxis.joinAxisPos = centerPointY plot.yValueAxis.joinAxisPos = centerPointX This produces a white axis centered on the point, but the lower half of the y-axis beneath the point is missing. How can I get the y-axis to descend to the bottom of the chart? Also, any suggestions as to how I can force the chart to center itself around the given point? thanks, Ian. -------------- next part -------------- An HTML attachment was scrubbed... URL: From IStevens at globeandmail.com Mon Jul 7 19:40:05 2008 From: IStevens at globeandmail.com (Stevens, Ian) Date: Mon, 7 Jul 2008 19:40:05 -0400 Subject: [reportlab-users] Specifying chart join axis to intersect pointdoes not draw line below that point In-Reply-To: Message-ID: Is it possible to do this using a Grid and/or axis ticks? (ie. make the grid or ticks start and end at the center point) thanks, Ian. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Stevens, Ian Sent: Friday, July 04, 2008 7:50 PM To: Support list for users of Reportlab software Subject: [reportlab-users] Specifying chart join axis to intersect pointdoes not draw line below that point I need a chart with 2 points on it, with one of the points centered on the chart intersected by two lines, one parallel to each axis. The result ishould be like a crosshair centered in the chart with one point at the center of the crosshair. I've accomplished most of what I need with ScatterPlot: centerPointX = ... centerPointY = ... plot = ScatterPlot() [...] plot.xValueAxis.strokeColor = plot.yValueAxis.strokeColor = colors.white plot.xValueAxis.joinAxisMode = plot.yValueAxis.joinAxisMode = 'value' plot.xValueAxis.joinAxisPos = centerPointY plot.yValueAxis.joinAxisPos = centerPointX This produces a white axis centered on the point, but the lower half of the y-axis beneath the point is missing. How can I get the y-axis to descend to the bottom of the chart? Also, any suggestions as to how I can force the chart to center itself around the given point? thanks, Ian. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gabriele.visconti at gmail.com Wed Jul 9 07:11:25 2008 From: gabriele.visconti at gmail.com (Gabriele Visconti) Date: Wed, 9 Jul 2008 13:11:25 +0200 Subject: [reportlab-users] problem with List printing with reportlab Message-ID: <3783b9970807090411p51e2742eo8324428b0b4bc944@mail.gmail.com> Hi everyone, I have one list which is dynamically modified. The elements are continuously added and removed depending on variables state. How can I print this list on a canvas so that the list elements are listed one below the other. To explain me better. I now do something like this: *sheet.drawString(45, 650, str(self.AccLabelList[:]))* What I obtain on the pdf is this: *[u'D Heating collar inclusive of installation and accessory', u'Ec Suction DN40/degasing DN10 automatic valves with installation(for LDPD - K with gas separator)']* What I want to obtain on the pdf is this: *D Heating collar inclusive of installation and accessory* *Ec Suction DN40/degasing DN10 automatic valves with installation(for LDPD - K with gas separator)* The problem is that I can't sort the list elements and just place them on the canvas because each time I don't know how many elements are stored in the list. Is it something that can be obtained in someway? Thank you very much, Gab -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.bizzarri at gmail.com Wed Jul 9 07:49:19 2008 From: marco.bizzarri at gmail.com (Marco Bizzarri) Date: Wed, 9 Jul 2008 13:49:19 +0200 Subject: [reportlab-users] problem with List printing with reportlab In-Reply-To: <3783b9970807090411p51e2742eo8324428b0b4bc944@mail.gmail.com> References: <3783b9970807090411p51e2742eo8324428b0b4bc944@mail.gmail.com> Message-ID: <3f0d61c40807090449s1ed29900te7057d209df35c85@mail.gmail.com> Hi, Gabriele, I'm not sure I understood your problem. I think you've to explain your problem a little. You can obtain the length of a list l using len(l), so you could not in that place what is the length of the list. I do not understand what the length of the list has to do with the sorting of the list itself. The output of you're seeing is the string representation of a list of strings. You could do something like this: to_be_sorted = self.AccLabelList[:] to_be_sorted.sort() start = 650 for label in to_be_sorted: sheet.drawString(45, start, label) start = start + 25 Is this useful for you? Regards Marco On Wed, Jul 9, 2008 at 1:11 PM, Gabriele Visconti wrote: > Hi everyone, > I have one list which is dynamically modified. The elements are continuously > added and removed depending on variables state. > How can I print this list on a canvas so that the list elements are listed > one below the other. > To explain me better. > I now do something like this: > sheet.drawString(45, 650, str(self.AccLabelList[:])) > What I obtain on the pdf is this: > [u'D Heating collar inclusive of installation and accessory', u'Ec Suction > DN40/degasing DN10 automatic valves with installation(for LDPD - K with gas > separator)'] > What I want to obtain on the pdf is this: > D Heating collar inclusive of installation and accessory > Ec Suction DN40/degasing DN10 automatic valves with installation(for LDPD - > K with gas separator) > > The problem is that I can't sort the list elements and just place them on > the canvas because each time I don't know how many elements are stored in > the list. > Is it something that can be obtained in someway? > > Thank you very much, > > Gab > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > > -- Marco Bizzarri http://iliveinpisa.blogspot.com/ From justinasu at gmail.com Wed Jul 9 11:02:33 2008 From: justinasu at gmail.com (Justinas Urbanavicius) Date: Wed, 9 Jul 2008 18:02:33 +0300 Subject: [reportlab-users] problem with reportlab generating pdf Message-ID: hi, i'm using pisa 3.0 with is based on reportlab and when trying to convert html file to pdf, the following error is produced. i myself can't understand a single thing what is here written, maybe someone can helpout? %PDF-1.3 %?? ReportLab Generated PDF document http://www.reportlab.com % 'BasicFonts': class PDFDictionary 1 0 obj % The standard fonts dictionary << /F1 2 0 R >> endobj % 'F1': class PDFType1Font 2 0 obj % Font Helvetica << /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >> endobj % 'Page1': class PDFPage 3 0 obj % Page dictionary << /Contents 7 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 6 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >> /Type /Page >> endobj % 'R4': class PDFCatalog 4 0 obj % Document Root << /Outlines 8 0 R /PageMode /UseNone /Pages 6 0 R /Type /Catalog >> endobj % 'R5': class PDFInfo 5 0 obj << /Author () /CreationDate (20080709174242) /Keywords () /Producer (pisa HTML to PDF ) /Subject () /Title () >> endobj % 'R6': class PDFPages 6 0 obj % page tree << /Count 1 /Kids [ 3 0 R ] /Type /Pages >> endobj % 'R7': class PDFStream 7 0 obj % page stream << /Filter [ /ASCII85Decode /FlateDecode ] /Length 1797 >> stream GatU2>?g)X&:L2>S,^j at 0Ed.SpC "9c!YL6?+ at KA.&OL/?";4BhX0W?6gUD5IT^+eDQZTgMlI>'ul:SC5+hqjc1q0-\"1lSUQ36sjYX1n]H3[^??ba7$rGii?fu/D>9"Z8Q&s-Y#,RQY0bTd8m_5AV=!F!Q1Sq59%&0%iqc!ZGL%%]00S^I)qlYFV#F>q46A at c !,"8TOegLeoWYb+,^k/QohcrRPKCqG_drJHuRMeAcb59\rp_c[o7'!+D5YWV.J*cm8Fr=i)eAiO6^!'fM?T)^mp(b4ERO59'8G)-T!6jBng1i9#4T*X2KOhq3h0LjG6I9<=!*Re+F_e\5IcGAKVIi)?AtoTMN?\j6m)(a_6M"5QC=gSh`&?kObe/;kfL(+#UZCe7LH$CCn+Dg5^5UtB.,HoLOgjJQN!kRh/[f'@ [c3CK57dp_BQ*PIU1BNmg*SrAY>e;0H5Qh8)4Ug=<4Xa>f_+35O'ioieBr$4<*iA`Y'!ui32!^[eG2(?Ca!s@ /o7ks94G[ihV#>298ihu)pM8q\"h7-5>g>>CGB!_7')'SO;OQNWL+=:n7?>BRjE]jCO=WZum=+;#L;1C[#>_`B0*HG at C !GLX#!B4j7fV5>j5;X:48_ZA^2F[S5ci&eRI"TYCtX!8R>Y7&u1HHH251_:c![R/Jf5:9S5LQnk9N[[='irZ1=DA=KP^BB+-8nmFH/i[smqZiksK<l%QBIfp:?Pf-:gLXgtOQ)uWoFf,OG4qTF_R.:rjBJ+P?dOL^\P2d.l`RB,*4F>t42]UFSqB`j7f\a^2I$A3G8'K3S"%PUu+9KhAXOe8Ul79MS'3qHP+HlnLJSP,*", at 74H>hM3kc6g6,;3.$BjF@ ?tKpK8:hEoV4rc%pIUAlj`20LL"[F#uZ)S8Z>jb?Z:H>"[G8hUt^SDpV3jnV#*p(6c-r-$nkKfo&L\Z?psf"6=(pHSrl?*,j!+3B+-"aQGY!i(66*@rssoBb4PQFIdFs*UCb0NmCs4Sj\bV+4<12bendstream endobj % 'R8': class PDFOutlines 8 0 obj << /Count 0 /Type /Outlines >> endobj xref 0 9 0000000000 65535 f 0000000113 00000 n 0000000209 00000 n 0000000372 00000 n 0000000649 00000 n 0000000783 00000 n 0000000975 00000 n 0000001080 00000 n 0000003022 00000 n trailer << /ID % ReportLab generated PDF document -- digest (http://www.reportlab.com) [(43\362&E\261|\371\232\265E\023/`\363q) (43\362&E\261|\371\232\265E\023/`\363q)] /Info 5 0 R /Root 4 0 R /Size 9 >> startxref 3073 %%EOF -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at reportlab.com Wed Jul 9 12:08:24 2008 From: andy at reportlab.com (Andy Robinson) Date: Wed, 9 Jul 2008 17:08:24 +0100 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: References: Message-ID: <956003ae0807090908q113a1990qf6c85c65320411a7@mail.gmail.com> 2008/7/9 Justinas Urbanavicius : > hi, i'm using pisa 3.0 with is based on reportlab and when trying to convert > html file to pdf, the following error is produced. It's not an error message, it's a (normal looking) PDF file. I don't know Pisa, but maybe you need to redirect the output into a file. Save the output in a file and try acroread on it ;-) Best Regards, -- Andy Robinson From robin at reportlab.com Wed Jul 9 12:13:12 2008 From: robin at reportlab.com (Robin Becker) Date: Wed, 09 Jul 2008 17:13:12 +0100 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: References: Message-ID: <4874E398.1000900@chamonix.reportlab.co.uk> Justinas Urbanavicius wrote: > hi, i'm using pisa 3.0 with is based on reportlab and when trying to convert > html file to pdf, the following error is produced. > i myself can't understand a single thing what is here written, maybe someone > can helpout? the stuff below looks like a raw pdf document. If you're seeing it in a browser it probably means the server/application is not sending the right mime type or your browser is misinterpreting it (ie hasn't got a plugin for pdf etc etc). I would try and look at the pdf, but it has been totally corrupted by email and as PDF is a binary format I won't be able to use it. > > %PDF-1.3 > %?? ReportLab Generated PDF document http://www.reportlab.com > % 'BasicFonts': class PDFDictionary > 1 0 obj ........ > /Info 5 0 R > /Root 4 0 R > /Size 9 >> > startxref > 3073 > %%EOF > -- Robin Becker From justinasu at gmail.com Wed Jul 9 12:27:32 2008 From: justinasu at gmail.com (Justinas Urbanavicius) Date: Wed, 9 Jul 2008 19:27:32 +0300 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: <4874E398.1000900@chamonix.reportlab.co.uk> References: <4874E398.1000900@chamonix.reportlab.co.uk> Message-ID: well this i got when opening pdf file, there is this message only, instead of the wanted content. So i presumed that it was an error. if it was raw PDF like Andy wrote, i wouldn't see this strange marks when opened with adobe reader, and i did copy this from the pdf On Wed, Jul 9, 2008 at 7:13 PM, Robin Becker wrote: > Justinas Urbanavicius wrote: > >> hi, i'm using pisa 3.0 with is based on reportlab and when trying to >> convert >> html file to pdf, the following error is produced. >> i myself can't understand a single thing what is here written, maybe >> someone >> can helpout? >> > > the stuff below looks like a raw pdf document. If you're seeing it in a > browser it probably means the server/application is not sending the right > mime type or your browser is misinterpreting it (ie hasn't got a plugin for > pdf etc etc). I would try and look at the pdf, but it has been totally > corrupted by email and as PDF is a binary format I won't be able to use it. > > >> %PDF-1.3 >> %?? ReportLab Generated PDF document http://www.reportlab.com >> % 'BasicFonts': class PDFDictionary >> 1 0 obj >> > ........ > >> /Info 5 0 R >> /Root 4 0 R >> /Size 9 >> >> startxref >> 3073 >> %%EOF >> >> -- > Robin Becker > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Jul 9 13:31:29 2008 From: robin at reportlab.com (Robin Becker) Date: Wed, 09 Jul 2008 18:31:29 +0100 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: References: <4874E398.1000900@chamonix.reportlab.co.uk> Message-ID: <4874F5F1.8000006@chamonix.reportlab.co.uk> Justinas Urbanavicius wrote: > well this i got when opening pdf file, there is this message only, instead > of the wanted content. So i presumed that it was an error. if it was raw PDF > like Andy wrote, i wouldn't see this strange marks when opened with adobe > reader, and i did copy this from the pdf > The stange marks at the tope are actually some japanese glyph that andy put in to indicate early on that the PDF is actually an 8bit quantity ie not pure ascii text. Further down there's part of a compressed stream; other stuff is PDF controls/comments which are mostly, but not always human readable. This is indeed a PDF document by the looks of it. Is it possible that PDF was converted by something into PDF? It should certainly be possible to render most of a PDF document using reportlab. > On Wed, Jul 9, 2008 at 7:13 PM, Robin Becker wrote: > >> Justinas Urbanavicius wrote: >> >>> hi, i'm using pisa 3.0 with is based on reportlab and when trying to >>> convert >>> html file to pdf, the following error is produced. >>> i myself can't understand a single thing what is here written, maybe >>> someone >>> can helpout? >>> >> the stuff below looks like a raw pdf document. If you're seeing it in a >> browser it probably means the server/application is not sending the right >> mime type or your browser is misinterpreting it (ie hasn't got a plugin for >> pdf etc etc). I would try and look at the pdf, but it has been totally >> corrupted by email and as PDF is a binary format I won't be able to use it. >> >> >>> %PDF-1.3 >>> %?? ReportLab Generated PDF document http://www.reportlab.com >>> % 'BasicFonts': class PDFDictionary >>> 1 0 obj >>> >> ........ >> >>> /Info 5 0 R >>> /Root 4 0 R >>> /Size 9 >> >>> startxref >>> 3073 >>> %%EOF >>> >>> -- >> 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 -- Robin Becker From justinasu at gmail.com Wed Jul 9 14:03:32 2008 From: justinasu at gmail.com (Justinas Urbanavicius) Date: Wed, 9 Jul 2008 21:03:32 +0300 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: <4874F5F1.8000006@chamonix.reportlab.co.uk> References: <4874E398.1000900@chamonix.reportlab.co.uk> <4874F5F1.8000006@chamonix.reportlab.co.uk> Message-ID: ok maybe attaching the file itself will help out :) well when i open it isn't what is should be On Wed, Jul 9, 2008 at 8:31 PM, Robin Becker wrote: > Justinas Urbanavicius wrote: > >> well this i got when opening pdf file, there is this message only, instead >> of the wanted content. So i presumed that it was an error. if it was raw >> PDF >> like Andy wrote, i wouldn't see this strange marks when opened with adobe >> reader, and i did copy this from the pdf >> >> > The stange marks at the tope are actually some japanese glyph that andy put > in to indicate early on that the PDF is actually an 8bit quantity ie not > pure ascii text. Further down there's part of a compressed stream; other > stuff is PDF controls/comments which are mostly, but not always human > readable. This is indeed a PDF document by the looks of it. Is it possible > that PDF was converted by something into PDF? It should certainly be > possible to render most of a PDF document using reportlab. > > On Wed, Jul 9, 2008 at 7:13 PM, Robin Becker wrote: >> >> Justinas Urbanavicius wrote: >>> >>> hi, i'm using pisa 3.0 with is based on reportlab and when trying to >>>> convert >>>> html file to pdf, the following error is produced. >>>> i myself can't understand a single thing what is here written, maybe >>>> someone >>>> can helpout? >>>> >>>> the stuff below looks like a raw pdf document. If you're seeing it in a >>> browser it probably means the server/application is not sending the right >>> mime type or your browser is misinterpreting it (ie hasn't got a plugin >>> for >>> pdf etc etc). I would try and look at the pdf, but it has been totally >>> corrupted by email and as PDF is a binary format I won't be able to use >>> it. >>> >>> >>> %PDF-1.3 >>>> %?? ReportLab Generated PDF document http://www.reportlab.com >>>> % 'BasicFonts': class PDFDictionary >>>> 1 0 obj >>>> >>>> ........ >>> >>> /Info 5 0 R >>>> /Root 4 0 R >>>> /Size 9 >> >>>> startxref >>>> 3073 >>>> %%EOF >>>> >>>> -- >>>> >>> 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 >>> >> > > -- > Robin Becker > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ataskaita.pdf Type: application/pdf Size: 3508 bytes Desc: not available Url : From timr at probo.com Wed Jul 9 14:37:28 2008 From: timr at probo.com (Tim Roberts) Date: Wed, 09 Jul 2008 11:37:28 -0700 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: References: <4874E398.1000900@chamonix.reportlab.co.uk> <4874F5F1.8000006@chamonix.reportlab.co.uk> Message-ID: <48750568.5010500@probo.com> Justinas Urbanavicius wrote: > ok maybe attaching the file itself will help out :) > well when i open it isn't what is should be Right. What you have done here is generated a PDF document, then fetched that raw PDF document as a string, then printed that string as another PDF document. Basically, you have a nested screw-up. ;) Show us the script you used to generate this. From THAT, we can show you where you are going wrong. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From justinasu at gmail.com Wed Jul 9 14:43:33 2008 From: justinasu at gmail.com (Justinas Urbanavicius) Date: Wed, 9 Jul 2008 21:43:33 +0300 Subject: [reportlab-users] problem with reportlab generating pdf In-Reply-To: <48750568.5010500@probo.com> References: <4874E398.1000900@chamonix.reportlab.co.uk> <4874F5F1.8000006@chamonix.reportlab.co.uk> <48750568.5010500@probo.com> Message-ID: ok now i see what is the problem, thanks :) i don't think that showing yuo the script will help, couse i'm not using the reportlab directly but throu another python script that should convert entire html file into a pdf document http://www.htmltopdf.org/ as one of you pointed out i doubt that anyone knows this script. so basicaly i'm on my own from here. thanks again :) On Wed, Jul 9, 2008 at 9:37 PM, Tim Roberts wrote: > Justinas Urbanavicius wrote: > >> ok maybe attaching the file itself will help out :) >> well when i open it isn't what is should be >> > > Right. What you have done here is generated a PDF document, then fetched > that raw PDF document as a string, then printed that string as another PDF > document. Basically, you have a nested screw-up. ;) > > Show us the script you used to generate this. From THAT, we can show you > where you are going wrong. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mjf at pearson.co.uk Thu Jul 10 12:19:23 2008 From: mjf at pearson.co.uk (Matt Folwell) Date: Thu, 10 Jul 2008 17:19:23 +0100 Subject: [reportlab-users] Error in pdfmetrics.py trying to register the same encoding twice Message-ID: <4876368B.3070503@pearson.co.uk> There's code in pdfmetrics.py to cope if you try to register two identical encodings under the same name, but it doesn't work because Encoding.isEqual() doesn't take account of comparing an unfrozen encoding with a frozen one. (The vector is converted from a list to a tuple) Also the wrong error is raised when the encodings are different, because the Encoding's Name attribute shouldn't be capitalised. The attached patch against subversion head fixes both of these. Regards, Matt -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: reregister-encoding.patch Url: From robin at reportlab.com Thu Jul 10 12:25:38 2008 From: robin at reportlab.com (Robin Becker) Date: Thu, 10 Jul 2008 17:25:38 +0100 Subject: [reportlab-users] Error in pdfmetrics.py trying to register the same encoding twice In-Reply-To: <4876368B.3070503@pearson.co.uk> References: <4876368B.3070503@pearson.co.uk> Message-ID: <48763802.4090309@chamonix.reportlab.co.uk> Matt Folwell wrote: > There's code in pdfmetrics.py to cope if you try to register two > identical encodings under the same name, but it doesn't work because > Encoding.isEqual() doesn't take account of comparing an unfrozen > encoding with a frozen one. (The vector is converted from a list to a > tuple) > > Also the wrong error is raised when the encodings are different, because > the Encoding's Name attribute shouldn't be capitalised. > > The attached patch against subversion head fixes both of these. > > Regards, > Matt thanks I'll put it in straight away -- Robin Becker From wilk at flibuste.net Thu Jul 10 12:06:58 2008 From: wilk at flibuste.net (William Dode) Date: Thu, 10 Jul 2008 16:06:58 +0000 (UTC) Subject: [reportlab-users] error in tables.py (rl 1.21.2) Message-ID: Hi, I've a random error on a table, i mean that it depends of the datas and so it's difficult to reproduce... It raise : eportlab.platypus.tables:1103 in _getFirstPossibleSplitRowPosition << for rh in self._rowHeights: if h+rh>availHeight: break if not impossible.has_key(n):>> if h+rh>availHeight: TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' in fact rh is None and self._rowHeights = [None, None, None] I could resolve the problem by adding rh = rh or 0 but i don't know why... Any idea if i do something wrong or if it's a know bug ? thx -- William Dod? - http://flibuste.net Informaticien ind?pendant From danielsb2 at hotmail.com Fri Jul 11 08:23:16 2008 From: danielsb2 at hotmail.com (Daniel de Sousa Barros) Date: Fri, 11 Jul 2008 09:23:16 -0300 Subject: [reportlab-users] More than 100 images (PNG) into a PDF report Message-ID: I'm trying to append more than 1000 images into one PDF report, but i get the "IOError: Too many..." Someone know solution for it? I'm trying to generate de report using reportlab + PIL. This is the code: ------------------------------------------------------------------------------------------ > for i in lista: >>>colab = Paragraph(i[0], style('1_b')) >>>imagem = Image(i[1]) #i tried lazy=2, but i get an error like this : "_file" >>>imagem.drawHeight = 18*cm * imagem.drawHeight / imagem.drawWidth >>>imagem.drawWidth = 18*cm >>>story.append(imagem) >>>dados = [ >>> [colab, ''], >>> [imagem, ''] >>> ] >>>tabela = Table(dados, [19.3*cm, 0.01*cm], repeatRows=True) >>>tabela.hAlign = "LEFT" >>>story.append(tabela) >>>story.append(Spacer(0*cm, 1*cm)) >doc.build(story, onFirstPage = cabecalhoRetrato, >onLaterPages=cabecalhoRetrato) I do the same question in yhe python-list, but i dont' understand norseman... http://mail.python.org/pipermail/python-list/2008-July/498894.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From gherman at darwin.in-berlin.de Sat Jul 12 08:57:11 2008 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Sat, 12 Jul 2008 14:57:11 +0200 Subject: [reportlab-users] "ReportLab Paragraphs Reloaded" talk at EuroPython 2008 Message-ID: Hi, A few days ago at EuroPython 2008 I've given a presentation about my adventures so far in creating alternative paragraph implementations which you can download from: http://europython.org/TalkMaterials or more precisely (but with a longer link) from: http://europython.org/TalkMaterials?action=AttachFile&do=get&target=ReportlabParagraphsReloaded.pdf I'd like to invite people to have a look, download the package and play with it (see links inside the PDF file). I warmly appre- ciate your feedback, although I'll be travelling from monday again and I won't have that much time to respond during the next few weeks, though. Regards, Dinu From gradha at titanium.sabren.com Sun Jul 13 16:48:10 2008 From: gradha at titanium.sabren.com (Grzegorz Adam Hankiewicz) Date: Sun, 13 Jul 2008 22:48:10 +0200 Subject: [reportlab-users] Several questions about text output Message-ID: Hello. I'm creating a custom form like page and don't want to use platypus. I'm willing to output a string in the form "header: text" where the header part is bold. I thought I would output the header with a bold font, then the text with the normal face. However, how do I get the length of the header part? I was looking for some getStringSize(font, text) which would return the width and height of the expected text, but haven't. Also canvas.drawString doesn't return such information. On the font issue, how can I clip the text to a region? Let's say that I have a text too long to fit and don't want it to go out of the page. Is this done with the paths? From andy at reportlab.com Sun Jul 13 17:29:35 2008 From: andy at reportlab.com (Andy Robinson) Date: Sun, 13 Jul 2008 22:29:35 +0100 Subject: [reportlab-users] Several questions about text output In-Reply-To: References: Message-ID: <956003ae0807131429u1815f23cy633a71abf9c4d6ec@mail.gmail.com> 2008/7/13 Grzegorz Adam Hankiewicz : > Hello > > I'm creating a custom form like page and don't want to use platypus. > > I'm willing to output a string in the form "header: text" where the header > part is bold. I thought I would output the header with a bold font, then the > text with the normal face. However, how do I get the length of the header > part? I was looking for some getStringSize(font, text) which would return It's called stringWidth(..) and it's available as a canvas method, or a function in reportlab.pdfbase.pfdmetrics.stringWidth - Andy From gradha at titanium.sabren.com Sun Jul 13 17:51:09 2008 From: gradha at titanium.sabren.com (Grzegorz Adam Hankiewicz) Date: Sun, 13 Jul 2008 23:51:09 +0200 Subject: [reportlab-users] Several questions about text output In-Reply-To: <956003ae0807131429u1815f23cy633a71abf9c4d6ec@mail.gmail.com> References: <956003ae0807131429u1815f23cy633a71abf9c4d6ec@mail.gmail.com> Message-ID: <5988D2AE-B970-41D1-A8C2-8B3EB70005B5@titanium.sabren.com> El 13/07/2008, a las 23:29, Andy Robinson escribi?: > 2008/7/13 Grzegorz Adam Hankiewicz : >> However, how do I get the length of the header >> part? I was looking for some getStringSize(font, text) which would >> return > > It's called stringWidth(..) and it's available as a canvas method, or > a function in reportlab.pdfbase.pfdmetrics.stringWidth Ah, I had missed that one. Thanks! From robin at reportlab.com Mon Jul 14 04:59:51 2008 From: robin at reportlab.com (Robin Becker) Date: Mon, 14 Jul 2008 09:59:51 +0100 Subject: [reportlab-users] error in tables.py (rl 1.21.2) In-Reply-To: References: Message-ID: <487B1587.6060306@chamonix.reportlab.co.uk> William Dode wrote: > Hi, > > I've a random error on a table, i mean that it depends of the datas and > so it's difficult to reproduce... > > It raise : > > eportlab.platypus.tables:1103 in _getFirstPossibleSplitRowPosition > << for rh in self._rowHeights: > if h+rh>availHeight: > break > if not impossible.has_key(n):>> if h+rh>availHeight: > > TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' > > in fact rh is None and self._rowHeights = [None, None, None] > > I could resolve the problem by adding rh = rh or 0 but i don't know > why... > > Any idea if i do something wrong or if it's a know bug ? > > thx > I'm not certain; we certainly have tests which have one or more rowheights set as None. Have you got a simple example? -- Robin Becker From wilk at flibuste.net Mon Jul 14 07:03:52 2008 From: wilk at flibuste.net (William Dode) Date: Mon, 14 Jul 2008 11:03:52 +0000 (UTC) Subject: [reportlab-users] error in tables.py (rl 1.21.2) References: <487B1587.6060306@chamonix.reportlab.co.uk> Message-ID: On 14-07-2008, Robin Becker wrote: > William Dode wrote: >> Hi, >> >> I've a random error on a table, i mean that it depends of the datas and >> so it's difficult to reproduce... >> >> It raise : >> >> eportlab.platypus.tables:1103 in _getFirstPossibleSplitRowPosition >> << for rh in self._rowHeights: >> if h+rh>availHeight: >> break >> if not impossible.has_key(n):>> if h+rh>availHeight: >> >> TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' >> >> in fact rh is None and self._rowHeights = [None, None, None] >> >> I could resolve the problem by adding rh = rh or 0 but i don't know >> why... >> >> Any idea if i do something wrong or if it's a know bug ? >> >> thx >> > > I'm not certain; we certainly have tests which have one or more rowheights set > as None. Have you got a simple example? It's difficult because it only append somes times on the middle of a long report... But i catch it ! You'll see that i use LongTable even if they are not long, because i use a generic library. from reportlab.platypus import BaseDocTemplate, Frame, Paragraph, NextPageTemplate, PageBreak, PageTemplate, Spacer, KeepTogether, Flowable from reportlab.lib.pagesizes import A4, landscape, portrait, cm from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_LEFT, TA_CENTER from reportlab.lib import colors from reportlab.platypus.tables import TableStyle, LongTable, Table f=open('/tmp/t.pdf','w') frame = Frame(2 * cm, 2 * cm , A4[0] - 4 * cm, A4[1] - 6*cm) doc = BaseDocTemplate(f, pagesize=A4) doc.addPageTemplates(PageTemplate('i',frame)) style_para = getSampleStyleSheet()['Normal'] style_para.spaceAfter = 12 elements = [] for z in (3,6,3,5,12,7,3,4,6,3,8): elements.append( Paragraph('toto',style_para)) elements.append(LongTable([('x') for x in range(z)], repeatRows=1)) doc.build(elements) -- William Dod? - http://flibuste.net Informaticien ind?pendant From IStevens at globeandmail.com Mon Jul 14 14:09:08 2008 From: IStevens at globeandmail.com (Stevens, Ian) Date: Mon, 14 Jul 2008 14:09:08 -0400 Subject: [reportlab-users] Specifying chart join axis to intersectpointdoes not draw line below that point In-Reply-To: Message-ID: In case someone needs something like this in future, I did this by: - extending ScatterPlot and overriding makeBackground() to draw a crosshair in the center. - making the min/max values for the chart's value axes to be equal offsets from the center point such that the second point is still inside the chart (eg. xValueAxis.valueMin = centerPoint-abs(otherPoint.x-centerPoint.x)) - setting the avoidBoundFrac on the value axes so that the second point doesn't rest on the chart box boundary. Ian. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Stevens, Ian Sent: Monday, July 07, 2008 7:40 PM To: Support list for users of Reportlab software Subject: Re: [reportlab-users] Specifying chart join axis to intersectpointdoes not draw line below that point Is it possible to do this using a Grid and/or axis ticks? (ie. make the grid or ticks start and end at the center point) thanks, Ian. ________________________________ From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Stevens, Ian Sent: Friday, July 04, 2008 7:50 PM To: Support list for users of Reportlab software Subject: [reportlab-users] Specifying chart join axis to intersect pointdoes not draw line below that point I need a chart with 2 points on it, with one of the points centered on the chart intersected by two lines, one parallel to each axis. The result ishould be like a crosshair centered in the chart with one point at the center of the crosshair. I've accomplished most of what I need with ScatterPlot: centerPointX = ... centerPointY = ... plot = ScatterPlot() [...] plot.xValueAxis.strokeColor = plot.yValueAxis.strokeColor = colors.white plot.xValueAxis.joinAxisMode = plot.yValueAxis.joinAxisMode = 'value' plot.xValueAxis.joinAxisPos = centerPointY plot.yValueAxis.joinAxisPos = centerPointX This produces a white axis centered on the point, but the lower half of the y-axis beneath the point is missing. How can I get the y-axis to descend to the bottom of the chart? Also, any suggestions as to how I can force the chart to center itself around the given point? thanks, Ian. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gradha at titanium.sabren.com Mon Jul 14 16:43:32 2008 From: gradha at titanium.sabren.com (Grzegorz Adam Hankiewicz) Date: Mon, 14 Jul 2008 22:43:32 +0200 Subject: [reportlab-users] Several questions about text output In-Reply-To: References: Message-ID: El 13/07/2008, a las 22:48, Grzegorz Adam Hankiewicz escribi?: > On the font issue, how can I clip the text to a region? Let's say > that I have a text too long to fit and don't want it to go out of > the page. Is this done with the paths? I found the answer at http://two.pairlist.net/pipermail/reportlab-users/2005-February/003717.html . However, now I am having a problem calculating the bounding box of a font. When I draw a text string at 0,0, letters like 'g' or 'j' descend below the 0 y coordinate into negative numbers. I know the font size, but I don't know how much do I have to displace my bounding box in order to not have the lower part of the letters being clipped. In the reference manual I found the word "baseline" ppear in the setRise documentation, but that doesn't help me. Any suggestions? From robin at reportlab.com Mon Jul 14 18:59:51 2008 From: robin at reportlab.com (Robin Becker) Date: Mon, 14 Jul 2008 23:59:51 +0100 Subject: [reportlab-users] Several questions about text output In-Reply-To: References: Message-ID: <487BDA67.8000607@jessikat.plus.net> Grzegorz Adam Hankiewicz wrote: > > El 13/07/2008, a las 22:48, Grzegorz Adam Hankiewicz escribi?: > >> On the font issue, how can I clip the text to a region? Let's say that >> I have a text too long to fit and don't want it to go out of the page. >> Is this done with the paths? > > I found the answer at > http://two.pairlist.net/pipermail/reportlab-users/2005-February/003717.html. > However, now I am having a problem calculating the bounding box of a font. > > When I draw a text string at 0,0, letters like 'g' or 'j' descend below > the 0 y coordinate into negative numbers. I know the font size, but I > don't know how much do I have to displace my bounding box in order to > not have the lower part of the letters being clipped. > > In the reference manual I found the word "baseline" ppear in the setRise > documentation, but that doesn't help me. Any suggestions? ...... if you use String objects from the graphics library you can see the bounding boxes with getBounds, but as in the canvas we use the old standards from Gutenberg etc etc. When we draw a string the x coord is the start of the first character, but the y coord always refers to the baseline of the font. Typically in western glyphs that's the same as the bottom of cap A. That being the case then always stuff like y/j descends below. In recent reportlab you can do this ascent,descent = getAscentDescent(fontName,fontSize) if you don't specify fontSize then 1000 is assumed. This will return the values for the ascent and descent of the font from the baseline. So for fontSize x your string box will be x,y-descent,x+stringWidth(s,fontName,fontSize),y+ascent hope this isn't too arcane -- Robin Becker From gradha at titanium.sabren.com Tue Jul 15 15:13:33 2008 From: gradha at titanium.sabren.com (Grzegorz Adam Hankiewicz) Date: Tue, 15 Jul 2008 21:13:33 +0200 Subject: [reportlab-users] Several questions about text output In-Reply-To: <487BDA67.8000607@jessikat.plus.net> References: <487BDA67.8000607@jessikat.plus.net> Message-ID: <83078B1A-9A93-498D-86AF-32EF3AC852B6@titanium.sabren.com> El 15/07/2008, a las 0:59, Robin Becker escribi?: > [...] > ascent,descent = getAscentDescent(fontName,fontSize) > > if you don't specify fontSize then 1000 is assumed. > > This will return the values for the ascent and descent of the font > from the baseline. So for fontSize x your string box will be > > > x,y-descent,x+stringWidth(s,fontName,fontSize),y+ascent > > hope this isn't too arcane Well, it works and that's good enough for me. Thanks. From mhearne at usgs.gov Tue Jul 15 17:07:00 2008 From: mhearne at usgs.gov (Michael Hearne) Date: Tue, 15 Jul 2008 15:07:00 -0600 Subject: [reportlab-users] using pageCatcher with reportlab Message-ID: <487D1174.9030407@usgs.gov> I just got a 30-day license of pageCatcher from ReportLab, and I'm trying to figure out how to use it to embed PDF images in a document in the same way that one would an Image. I would like to be able to position the embedded PDF image at a particular position - the pageCatcher intro document seems to suggest that this is possible (they mention corporate logos, for example) but I can't find any samples in the distribution that do anything other than sticking PDF files together, or putting widgets (i.e., barcodes) on top of PDF files. Does anyone have a really simple example of pagecatcher used for something like placing a PDF logo into a Canvas? Thanks, Mike Hearne -- ------------------------------------------------------ Michael Hearne mhearne at usgs.gov (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------ From viktor.ikonnikov at gmail.com Wed Jul 16 01:20:40 2008 From: viktor.ikonnikov at gmail.com (=?KOI8-R?B?98nL1M/SIOnLz87OycvP1w==?=) Date: Wed, 16 Jul 2008 11:20:40 +0600 Subject: [reportlab-users] Table expand. Message-ID: How I can expand table on whole page? Please help me?! :( -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at alexiapress.com Tue Jul 22 01:25:34 2008 From: info at alexiapress.com (General Information) Date: Tue, 22 Jul 2008 01:25:34 -0400 Subject: [reportlab-users] PDF In Report Message-ID: Is there a way to import a PDF as an image in the report? Anyone have code samples? From mhearne at usgs.gov Tue Jul 22 09:14:27 2008 From: mhearne at usgs.gov (Michael Hearne) Date: Tue, 22 Jul 2008 07:14:27 -0600 Subject: [reportlab-users] PDF In Report In-Reply-To: References: Message-ID: <4885DD33.6050108@usgs.gov> You need to buy a license of PageCatcher from ReportLab - it allows you to import PDF's. As far as I could tell, there was no other way to bring in vector images to the open source ReportLab software. I tried for a while to use PyX, which allows you to embed postscript images in a larger document, but it was a lot of work, and I finally gave up and decided to pay for the extra functionality. --Mike General Information wrote: > Is there a way to import a PDF as an image in the report? Anyone have > code samples? > _______________________________________________ > reportlab-users mailing list > reportlab-users at reportlab.com > http://two.pairlist.net/mailman/listinfo/reportlab-users -- ------------------------------------------------------ Michael Hearne mhearne at usgs.gov (303) 273-8620 USGS National Earthquake Information Center 1711 Illinois St. Golden CO 80401 Senior Software Engineer Synergetics, Inc. ------------------------------------------------------ From przemyslaw.kukulski at gmail.com Tue Jul 22 14:55:28 2008 From: przemyslaw.kukulski at gmail.com (=?ISO-8859-2?Q?Przemys=B3aw_Kukulski?=) Date: Tue, 22 Jul 2008 20:55:28 +0200 Subject: [reportlab-users] using setWordSpacing for textobject Message-ID: Hello everyone! I'm creating simple documents (many documents from the same template with user data) that contains some bold text inside which i want to justify. Since i know always where bold text is i've figured out something like that: i.e. Person Dimmur blablabla c = canvas.Canvas("some_file.pdf") c.setFont('Comic', 10) obj = textobject.PDFTextObject(c) obj.setWordSpace(0) obj.setTextOrigin(margin_left, PAGE_HEIGHT - position) obj.setFont('Comic', 10) obj.textOut('Person ') obj.setFont('Comic-Bold', 10) obj.textOut(' %s' % name) obj.setFont('Comic', 10) obj.textOut(' blablabla') x= obj.getX() s = (PAGE_WIDTH - margin_right - x)/ 8 but i cannot set wordspacing on this textobject - from what i found i can do it as in line 2 to get it work for all line. Is there any simplier way to create normal document where block of text contains bolder/italic text that is justified to some margins? Thanks for answers -------------- next part -------------- An HTML attachment was scrubbed... URL: From zpranji at hotmail.com Wed Jul 23 05:43:42 2008 From: zpranji at hotmail.com (Zvjezdan Pranjic) Date: Wed, 23 Jul 2008 11:43:42 +0200 Subject: [reportlab-users] Modify marker(FilledCross) size Message-ID: Hi everyone, I'm developing some chart for an auction monitor. There are two axis (x and y) and there are some markers for the auction bids. The problem is, that the markers (for example 'makeMarker("FilledSquare")' ) are to small. Is there any chance to modify the size of them? I would like to make them bigger. Hope someone can help. Thanks in advice. Zvjezdan _________________________________________________________________ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE -------------- next part -------------- An HTML attachment was scrubbed... URL: From robin at reportlab.com Wed Jul 23 06:07:26 2008 From: robin at reportlab.com (Robin Becker) Date: Wed, 23 Jul 2008 11:07:26 +0100 Subject: [reportlab-users] Modify marker(FilledCross) size In-Reply-To: References: Message-ID: <488702DE.9020608@chamonix.reportlab.co.uk> Zvjezdan Pranjic wrote: > Hi everyone, > > I'm developing some chart for an auction monitor. There are two axis (x and y) and there are some markers for the auction bids. The problem is, that the markers (for example 'makeMarker("FilledSquare")' ) are to small. > Is there any chance to modify the size of them? I would like to make them bigger. > > Hope someone can help. Thanks in advice. > > Zvjezdan > hi, the objects that are returned by makeMarker have properties that you can set. You need to set the size=20 Markers are coded in reportlab/graphics/widgets/markers.py there you can see that we have properties like kind = 'FilledSquare', strokeColor = black, strokeWidth = 0.1, fillColor = None, size = 5, x = 0, y = 0, dx = 0, dy = 0, angle = 0, arrowBarbDx = -1.25, arrowHeight = 1.875, hope this helps -- Robin Becker From adam at flossmanuals.net Sun Jul 27 15:41:58 2008 From: adam at flossmanuals.net (adam hyde) Date: Sun, 27 Jul 2008 21:41:58 +0200 Subject: [reportlab-users] embedding standard fonts Message-ID: <1217187718.7289.41.camel@resetera> hi I am using reportlab to generate pdf for print on demand. I need all fonts embedded but reportlab doesn't embed standard fonts. In the last day I have been through the list and seen this reported elsewhere but I cannot find a solution posted...any suggestions? adam -- Adam Hyde FLOSS Manuals http://www.flossmanuals.net + 31 6 2808 7108 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : From srdjan_veljkovic at yahoo.com Mon Jul 28 09:07:13 2008 From: srdjan_veljkovic at yahoo.com (Srdjan Veljkovic) Date: Mon, 28 Jul 2008 06:07:13 -0700 (PDT) Subject: [reportlab-users] TTF fonts with non-Unicode mappings Message-ID: <823614.39521.qm@web37608.mail.mud.yahoo.com> Hi,Through trial-and-error and a lot of print statements inserted in ReportLab code, I have "discovered" that ReportLab uses only the Unicode mappings ("cmap" tables) in TTF fonts. Some fonts have other mappings too, and actually don't have some glyphs mapped in the Unicode tables, but in these other tables. The fonts delivered with ReportLab (Bitstream Vera Sans) are like this - they containt cyrillic glyphs (and possibly other, I was interested in cyrillic), but cyrillic glyphs are not mapped in the Unicode "cmap" table, they are mapped in the other cmap table (Vera TTF fonts have two "cmap" tables). ReportLab reads only the Unicode table, doesn't find the Unicode code for cyrillic letters (0x04..) in this table, and you get "rectangles" when viewing the generated PDF. The ugly thing is that you can use these fonts (Vera and others too - Luxi for example) in applications, like OpenOffice.org Writer, and get PDFs with cyrillic glyphs.The workaround is to use TTF fonts with "full" (or _just_) Unicode mappings, like DejaVu.I have a few points:1. This should be documented, so that people other than me don't loose two days over this. :)2. Maybe Vera fonts should be changed with DejaVu fonts in ReportLab distribution. I mean, you expect the fonts delivered with ReportLab to work with ReportLab, so this would be better than just documenting.3. Maybe it is not so difficult to support these other mappings. I'm not a Python expert, but I think Python has standard encoding mapping libraries. It should be sufficient to read the encoding of the "cmap" table in TTF, and use it to translate the glyph codes to Unicode. I was actually on the verge of coding this, before I "discovered" DejaVu fonts. Maybe I will code this if I happen to need some font, with no replacement for it, but I think someone with more Python knowledge is a better candidate for coding it.Best regards,Srdjan -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jul 28 14:08:56 2008 From: timr at probo.com (Tim Roberts) Date: Mon, 28 Jul 2008 11:08:56 -0700 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <1217187718.7289.41.camel@resetera> References: <1217187718.7289.41.camel@resetera> Message-ID: <488E0B38.9040804@probo.com> adam hyde wrote: > I am using reportlab to generate pdf for print on demand. I need all > fonts embedded but reportlab doesn't embed standard fonts. > Right, because Postscript renderers are supposed to have all of the standard fonts embedded in them already. That's where the term "standard fonts" comes from. Why do you want them embedded in the PDF? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From adam at flossmanuals.net Mon Jul 28 14:40:10 2008 From: adam at flossmanuals.net (adam hyde) Date: Mon, 28 Jul 2008 20:40:10 +0200 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <488E0B38.9040804@probo.com> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> Message-ID: <1217270410.7164.156.camel@resetera> On Mon, 2008-07-28 at 11:08 -0700, Tim Roberts wrote: > adam hyde wrote: > > I am using reportlab to generate pdf for print on demand. I need all > > fonts embedded but reportlab doesn't embed standard fonts. > > > > Right, because Postscript renderers are supposed to have all of the > standard fonts embedded in them already. That's where the term > "standard fonts" comes from. > > Why do you want them embedded in the PDF? It because the Print on Demand service I use requires it. When I upload the PDF it spits it out. They won't change the system and Its not an option for me to choose another PoD service (really) - so I need to work out how to get the fonts embedded. adam > -- Adam Hyde FLOSS Manuals http://www.flossmanuals.net + 31 6 2808 7108 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : From robin at reportlab.com Tue Jul 29 05:52:49 2008 From: robin at reportlab.com (Robin Becker) Date: Tue, 29 Jul 2008 10:52:49 +0100 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <1217270410.7164.156.camel@resetera> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> Message-ID: <488EE871.6080506@chamonix.reportlab.co.uk> adam hyde wrote: > On Mon, 2008-07-28 at 11:08 -0700, Tim Roberts wrote: >> adam hyde wrote: >>> I am using reportlab to generate pdf for print on demand. I need all >>> fonts embedded but reportlab doesn't embed standard fonts. >>> >> Right, because Postscript renderers are supposed to have all of the >> standard fonts embedded in them already. That's where the term >> "standard fonts" comes from. >> >> Why do you want them embedded in the PDF? > > It because the Print on Demand service I use requires it. When I upload > the PDF it spits it out. They won't change the system and Its not an > option for me to choose another PoD service (really) - so I need to work > out how to get the fonts embedded. > > adam > ...... There are/were some examples of embedding T1 fonts in the main tests area. I think you'll need the afm and pfb files for your standard fonts (see eg http://www.reportlab.com/ftp/pfbfer.zip). You'll also need to give them names other than the standard ones so you can use them in reportlab without clashing. with the real standard fonts (which won't be embedded). -- Robin Becker From adam at flossmanuals.net Tue Jul 29 08:54:22 2008 From: adam at flossmanuals.net (adam hyde) Date: Tue, 29 Jul 2008 14:54:22 +0200 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <488EE871.6080506@chamonix.reportlab.co.uk> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> <488EE871.6080506@chamonix.reportlab.co.uk> Message-ID: <1217336062.7502.85.camel@resetera> > > > ...... > There are/were some examples of embedding T1 fonts in the main tests area. I > think you'll need the afm and pfb files for your standard fonts (see eg > http://www.reportlab.com/ftp/pfbfer.zip). You'll also need to give them names > other than the standard ones so you can use them in reportlab without clashing. > with the real standard fonts (which won't be embedded). you mean different file names or change the name of the font family within the file with something like fontforge? adam -- Adam Hyde FLOSS Manuals http://www.flossmanuals.net + 31 6 2808 7108 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : From dirk.holtwick at gmail.com Tue Jul 29 09:18:33 2008 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Tue, 29 Jul 2008 15:18:33 +0200 Subject: [reportlab-users] ReportLab and AcroForm In-Reply-To: <200704160051.57016.srichter@cosmos.phy.tufts.edu> References: <200704160051.57016.srichter@cosmos.phy.tufts.edu> Message-ID: <488F18A9.2040100@gmail.com> Stephan Richter wrote: > Hi all, > > I have looked at reportlab.pdfbase.pdfform today. The support for Acroforms > seems very minimal. Is there any development in this area? > > Over time I might be interested in developing better Acroform support. I have > downloaded the PDF reference and can see a basic structure. Is there higher > level documentation on how to implement new features at this low level? > > Regards, > Stephan Hi, since this mail has never been answered I have to place the question again ;) I'm also interested in using the AcroForm feature in Platypus. Are there any examples? Stephan, did you improve this feature as mentioned in your mail? I already wrote a simple flowable that should write a checkbox, but this didn't work. I think AcroForm needs to do some manipulations that are refused by Platypus? Here is my example: -----------------8<---------------[cut here] import reportlab.pdfbase.pdfform as pdfform class PmlInput(Flowable): def __init__(self, width=10, height=10): self.width = width self.height = height def wrap(self, *args): return (self.width, self.height) def draw(self): c = self.canv pdfform.buttonFieldAbsolute(c, "field2", "Yes", 0, 0) c.rect(0, 0, self.width, self.height) -----------------8<---------------[cut here] Thanks in advance Dirk From dirk.holtwick at gmail.com Tue Jul 29 09:45:08 2008 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Tue, 29 Jul 2008 15:45:08 +0200 Subject: [reportlab-users] ReportLab and AcroForm In-Reply-To: <488F18A9.2040100@gmail.com> References: <200704160051.57016.srichter@cosmos.phy.tufts.edu> <488F18A9.2040100@gmail.com> Message-ID: <488F1EE4.3010904@gmail.com> Oops, my fault. I had to use relative functions and everything works fine: > pdfform.buttonFieldAbsolute(c, "field2", "Yes", 0, 0) Instead use: pdfform.buttonFieldRelative(c, "field2", "Yes", 0, 0) But I'm still interested if someone can provide more informations or examples on the AcroForm feature. Thanks. Dirk From robin at reportlab.com Tue Jul 29 10:05:39 2008 From: robin at reportlab.com (Robin Becker) Date: Tue, 29 Jul 2008 15:05:39 +0100 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <1217336062.7502.85.camel@resetera> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> <488EE871.6080506@chamonix.reportlab.co.uk> <1217336062.7502.85.camel@resetera> Message-ID: <488F23B3.8070400@chamonix.reportlab.co.uk> adam hyde wrote: >> ...... >> There are/were some examples of embedding T1 fonts in the main tests area. I >> think you'll need the afm and pfb files for your standard fonts (see eg >> http://www.reportlab.com/ftp/pfbfer.zip). You'll also need to give them names >> other than the standard ones so you can use them in reportlab without clashing. >> with the real standard fonts (which won't be embedded). > > you mean different file names or change the name of the font family > within the file with something like fontforge? ........ I thought this would be easy, but it seems we don't have the original afm files for these fonts which measn we need to synthesize some as I believe they're not freely available on the interweb. If we had them we could change the names in the reportlab internal data structure to allow the embedding to proceed without interfering with the standard fonts. I guess I'll try and think of a way to use the pfb file for embedding purposes without having the afm. -- Robin Becker From adam at flossmanuals.net Tue Jul 29 10:11:26 2008 From: adam at flossmanuals.net (adam hyde) Date: Tue, 29 Jul 2008 16:11:26 +0200 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <488F23B3.8070400@chamonix.reportlab.co.uk> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> <488EE871.6080506@chamonix.reportlab.co.uk> <1217336062.7502.85.camel@resetera> <488F23B3.8070400@chamonix.reportlab.co.uk> Message-ID: <1217340686.7502.97.camel@resetera> > ........ > I thought this would be easy, but it seems we don't have the original afm files > for these fonts which measn we need to synthesize some as I believe they're not > freely available on the interweb. If we had them we could change the names in > the reportlab internal data structure to allow the embedding to proceed without > interfering with the standard fonts. > > I guess I'll try and think of a way to use the pfb file for embedding purposes > without having the afm. any way to kill the standard font name check so it will embed the fonts anyway? a little switch --embed-all or something... adam -- Adam Hyde FLOSS Manuals http://www.flossmanuals.net + 31 6 2808 7108 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : From dirk.holtwick at gmail.com Tue Jul 29 10:45:35 2008 From: dirk.holtwick at gmail.com (Dirk Holtwick) Date: Tue, 29 Jul 2008 16:45:35 +0200 Subject: [reportlab-users] PDF In Report In-Reply-To: <4885DD33.6050108@usgs.gov> References: <4885DD33.6050108@usgs.gov> Message-ID: <488F2D0F.7080908@gmail.com> Hi, you may use PyPdf to manipulate an existing Report. If you use Pisa for generating your reports using HTML or XML it will offer an integrated solution that uses PyPdf to do that for you. There are also a lot of other tools like based on Java "iText" Library like pdftk that do similar things. Cheers Dirk Michael Hearne schrieb: > You need to buy a license of PageCatcher from ReportLab - it allows you > to import PDF's. As far as I could tell, there was no other way to > bring in vector images to the open source ReportLab software. I tried > for a while to use PyX, which allows you to embed postscript images in a > larger document, but it was a lot of work, and I finally gave up and > decided to pay for the extra functionality. > > --Mike > > General Information wrote: >> Is there a way to import a PDF as an image in the report? Anyone have >> code samples? >> _______________________________________________ >> reportlab-users mailing list >> reportlab-users at reportlab.com >> http://two.pairlist.net/mailman/listinfo/reportlab-users > From robin at reportlab.com Tue Jul 29 10:59:17 2008 From: robin at reportlab.com (Robin Becker) Date: Tue, 29 Jul 2008 15:59:17 +0100 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <1217340686.7502.97.camel@resetera> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> <488EE871.6080506@chamonix.reportlab.co.uk> <1217336062.7502.85.camel@resetera> <488F23B3.8070400@chamonix.reportlab.co.uk> <1217340686.7502.97.camel@resetera> Message-ID: <488F3045.6020005@chamonix.reportlab.co.uk> adam hyde wrote: >> ........ >> I thought this would be easy, but it seems we don't have the original afm files >> for these fonts which measn we need to synthesize some as I believe they're not >> freely available on the interweb. If we had them we could change the names in >> the reportlab internal data structure to allow the embedding to proceed without >> interfering with the standard fonts. >> >> I guess I'll try and think of a way to use the pfb file for embedding purposes >> without having the afm. > > any way to kill the standard font name check so it will embed the fonts > anyway? a little switch --embed-all or something... > > adam > > > All the standard fonts are registered in a different way ie by just naming them. First we need to create a new font that uses the PFB data (which is what actually will get embedded) and then some mechanism to obtain the metrics from the standard font data. So we need a simple override of EmbeddedType1Face that does approximately class StdEmbeddedT1Face(EmbeddedType1Face): def __init__(self,pfbFileName,stdName): TypeFace.__init__(self, stdName) self.stdName = stdName self.pfbFileName = os.path.abspath(pfbFileName) self.requiredEncoding = None self._loadGlyphs(pfbFileName) self._loadMetrics(stdName) def _loadMetrics(self,stdName): ....... and then we need to do stuff to inhibit the normal registration of the standard fonts and promote the embedded registration for the actually used fonts. Since these fonts are supposed to be standard and there are many assumptions related to their implicitness presence that will probably be hard. I guess you definitely need to eliminate the standard registration as your printer will be looking for the font. Perhaps it might be easier to try and inhibit the normal font registration, but use some other fonts instead? What happens when you try this def run(): from reportlab.pdfgen.canvas import Canvas from reportlab.pdfbase.pdfdoc import PDFName from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfbase.pdfmetrics import registerFont from reportlab.pdfbase import pdfdoc from reportlab import rl_config registerFont(TTFont('Vera','c:/code/reportlab/fonts/vera.ttf')) rl_config.canvas_basefontname='Vera' rl_config.invariant = 1 rl_config.pageCompression = 0 c = Canvas('trl_hello.pdf') c.setFont('Vera', 36) c.drawString(100,700, 'Hello World') c.setViewerPreference('PrintScaling',PDFName('None')) c.save() if __name__=='__main__': run() substitute the right path to vera.ttf. This doesn't use the standard names at all (at least in the pdf output). -- Robin Becker From srichter at cosmos.phy.tufts.edu Tue Jul 29 11:14:15 2008 From: srichter at cosmos.phy.tufts.edu (Stephan Richter) Date: Tue, 29 Jul 2008 08:14:15 -0700 Subject: [reportlab-users] PDF In Report In-Reply-To: <488F2D0F.7080908@gmail.com> References: <4885DD33.6050108@usgs.gov> <488F2D0F.7080908@gmail.com> Message-ID: <200807290814.15268.srichter@cosmos.phy.tufts.edu> On Tuesday 29 July 2008, Dirk Holtwick wrote: > you may use PyPdf to manipulate an existing > Report. If you use Pisa for generating your > reports using HTML or XML it will offer an integrated solution that uses > PyPdf to do that for you. z3c.rml also integrates PyPDF into RML. I demonstrated the feature by having a filled out W-2 form. Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. "Zope Stephan Richter" From adam at flossmanuals.net Tue Jul 29 12:50:24 2008 From: adam at flossmanuals.net (adam hyde) Date: Tue, 29 Jul 2008 18:50:24 +0200 Subject: [reportlab-users] embedding standard fonts In-Reply-To: <488F3045.6020005@chamonix.reportlab.co.uk> References: <1217187718.7289.41.camel@resetera> <488E0B38.9040804@probo.com> <1217270410.7164.156.camel@resetera> <488EE871.6080506@chamonix.reportlab.co.uk> <1217336062.7502.85.camel@resetera> <488F23B3.8070400@chamonix.reportlab.co.uk> <1217340686.7502.97.camel@resetera> <488F3045.6020005@chamonix.reportlab.co.uk> Message-ID: <1217350224.7502.108.camel@resetera> hey I think i just pass it thru gs: gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=fm-new.pdf -f fm.pdf adam On Tue, 2008-07-29 at 15:59 +0100, Robin Becker wrote: > adam hyde wrote: > >> ........ > >> I thought this would be easy, but it seems we don't have the original afm files > >> for these fonts which measn we need to synthesize some as I believe they're not > >> freely available on the interweb. If we had them we could change the names in > >> the reportlab internal data structure to allow the embedding to proceed without > >> interfering with the standard fonts. > >> > >> I guess I'll try and think of a way to use the pfb file for embedding purposes > >> without having the afm. > > > > any way to kill the standard font name check so it will embed the fonts > > anyway? a little switch --embed-all or something... > > > > adam > > > > > > > All the standard fonts are registered in a different way ie by just naming them. > First we need to create a new font that uses the PFB data (which is what > actually will get embedded) and then some mechanism to obtain the metrics from > the standard font data. > > So we need a simple override of EmbeddedType1Face that does approximately > > class StdEmbeddedT1Face(EmbeddedType1Face): > def __init__(self,pfbFileName,stdName): > TypeFace.__init__(self, stdName) > self.stdName = stdName > self.pfbFileName = os.path.abspath(pfbFileName) > self.requiredEncoding = None > self._loadGlyphs(pfbFileName) > self._loadMetrics(stdName) > > def _loadMetrics(self,stdName): > ....... > > and then we need to do stuff to inhibit the normal registration of the standard > fonts and promote the embedded registration for the actually used fonts. Since > these fonts are supposed to be standard and there are many assumptions related > to their implicitness presence that will probably be hard. > > I guess you definitely need to eliminate the standard registration as your > printer will be looking for the font. > > Perhaps it might be easier to try and inhibit the normal font registration, but > use some other fonts instead? > > What happens when you try this > > def run(): > from reportlab.pdfgen.canvas import Canvas > from reportlab.pdfbase.pdfdoc import PDFName > from reportlab.pdfbase.ttfonts import TTFont > from reportlab.pdfbase.pdfmetrics import registerFont > from reportlab.pdfbase import pdfdoc > from reportlab import rl_config > registerFont(TTFont('Vera','c:/code/reportlab/fonts/vera.ttf')) > rl_config.canvas_basefontname='Vera' > rl_config.invariant = 1 > rl_config.pageCompression = 0 > c = Canvas('trl_hello.pdf') > c.setFont('Vera', 36) > c.drawString(100,700, 'Hello World') > c.setViewerPreference('PrintScaling',PDFName('None')) > c.save() > > if __name__=='__main__': > run() > > substitute the right path to vera.ttf. This doesn't use the standard names at > all (at least in the pdf output). -- Adam Hyde FLOSS Manuals http://www.flossmanuals.net + 31 6 2808 7108 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : From jtk at yahoo.com Wed Jul 30 20:40:07 2008 From: jtk at yahoo.com (Jeff Kowalczyk) Date: Wed, 30 Jul 2008 20:40:07 -0400 Subject: [reportlab-users] easy_install reportlab References: <474F4E00.5060002@personnelware.com> <47501B51.6010804@personnelware.com> <243A8A25-4F00-44B1-9A91-C0327EC409AE@darwin.in-berlin.de> <200712011312.16992.srichter@cosmos.phy.tufts.edu> <475553A1.9080607@chamonix.reportlab.co.uk> <4755C145.2060100@personnelware.com> Message-ID: On Tue, 04 Dec 2007 15:06:13 -0600, Carl Karsten wrote: > On a clean box, install python, install easy install > > easy_install Reportlab-2.1.tar.gz (see my first post for where this came from) > > then run this: > > from reportlab.pdfgen import canvas > p = canvas.Canvas(open('test.pdf','wb')) > p.drawString(100, 100, "Hello world.") > p.showPage() > p.save() > > get the expected pdf. The tarball is packaged with a top-level heirarchy reportlab_2_1/reportlab, where setup.py lives. $ easy_install http://www.reportlab.org/ftp/ReportLab_2_1.tgz Downloading http://www.reportlab.org/ftp/ReportLab_2_1.tgz Processing ReportLab_2_1.tgz error: Couldn't find a setup script in /tmp/easy_install-LYwTTW/ReportLab_2_1.tgz When working around that, the setup.py does something easy_install (using virtualenv in this case) doesn't allow: $ easy_install reportlab_2_1/reportlab/ Processing Running setup.py -q bdist_egg --dist-dir /path/to/reportlab_2_1/reportlab/egg-dist-tmp-cN5vCY *************************************************** *No rl_accel code found, you can obtain it at * *http://www.reportlab.org/downloads.html#_rl_accel* *************************************************** warning: no files found matching '*.c' anywhere in distribution warning: no files found matching '*.h' anywhere in distribution warning: no files found matching '*.mashed' anywhere in distribution error: Setup script exited with error: SandboxViolation: mkdir('/opt/python25/python/lib/python2.5/site-packages/reportlab',) {} The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted. This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available. --- A packaging-only release would be greatly appreciated. Also, it's a workaround, but using PILwoTk can satisfy one of the major dependencies. Thanks, Jeff