469,626 Members | 861 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Re: Reportlab Image object opens filehandles

Daniel de Sousa Barros wrote:
>
----- Original Message ----- From: "norseman" <no******@hughes.net>
To: "Daniel de Sousa Barros" <da*******@hotmail.com>
Cc: <py*********@python.org>
Sent: Tuesday, July 08, 2008 6:49 PM
Subject: Re: Reportlab Image object opens filehandles

>>
Daniel de Sousa Barros wrote:
>>Hi Mr Robin,

I saw your post:
http://mail.python.org/pipermail/pyt...er/224781.html

I'm trying to append more than 1000 images into one PDF report, but i
get the IOError: Too many...

know you a solution for it?

Sorry by my english.... i'm brazilian and i'm learning english yet...
------------------------------------------------------------------------

--
http://mail.python.org/mailman/listinfo/python-list
====================
If you are using Microsoft:

First reaction: Increase the system pagefile (virtual memory) size.

Assuming lots of spare disk space you could change it to the 'on
demand' or 'let system handle it' setting. I don't know about Vista
but the rest top out about 4(or 2?)Gig per pagefile per disk. Forgot
which.

I don't know what imagery handling software you have, but if able, you
could consider 1) resizing images to final printed paper display size
and 2) make sure they are at or below 200dpi and jpeg in format before
entering them into the report.

If you are in Linux:

see the man pages on mkswap and swapon. Use files for swapspace. Easy
to create, easier to remove. Don't need to reconfigure hard drive. Can
be on another mounted drive. Use AbiWord or OpenOffice to set up text
pictures and all, print to file (will be a postscript) and use
ghostview (gv) to check results then use ghostscript (gs) to convert
to pdf. Final review in xpdf. ImageMagic's convert will do the image
manipulations mentioned in last paragraph of Microsoft section and
then some. All programs mentioned in the Linux section plus the
operating system are free for the download.
Steve
no******@hughes.net
================================================== ==

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 only need to increase the virtual memory? How i do it? I'm using
windows xp.

================================================

Click Start/settings/control panel/system/advanced/settings(in \
performance area)/advanced/change

set System managed size on
click SET box to right of above line
click positives (OK APPLY etc.) all way out, system will probably reboot

what is 'cm' in your code? In my world it means centimeter.

If you are trying to create full scale templates via raster methods you
will probably need more than 'Mom's" email machine. Junior's whiz-bang
game computer box probably won't work either.

Even at 72dpi
(72*72)*((18*2.54)*(18*2.54))*3
5184 *( 45.72 * 45.72) * 3
5184 * 2090.318 * 3
10,836,208 * 3
35,508,625.536 bytes per image
72dpi is normal for PDF/Postscript
5184 is dots per square inch
2090.318 is square inches per image
3 is one byte each, red,green,blue

Add margins and offsets and space between and.... even without that,
35.5 million times 1000 = 35500 million or 35.5 Gigabytes !!!?
In one file? Microsoft is going to have a problem with you. :)
If that is what you are trying to do - reach me direct. I'll show you
how. One of my photos takes 4 DVD's AFTER a 15 to 1 reduction in size.
Can't find a calculator? 4*4.5*15 = 270Gigs uncompressed, more or less.
Steve
no******@hughes.net
Jul 11 '08 #1
0 1304

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Andreas Jung | last post: by
reply views Thread by Robin Becker | last post: by
4 posts views Thread by Active8 | last post: by
15 posts views Thread by Anand Ganesh | last post: by
68 posts views Thread by Nak | last post: by
2 posts views Thread by Chuck | last post: by
reply views Thread by norseman | last post: by
16 posts views Thread by Laszlo Nagy | last post: by
reply views Thread by Robin Becker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.