Re: [Zope] Generating and Downloading PDF[Solved]

2005-05-13 Thread Andreas Jung

--On Freitag, 13. Mai 2005 13:43 Uhr -0300 Fernando Lujan 
<[EMAIL PROTECTED]> wrote:

This was the best solution that I could thought, once reportlab didn't
create PDF "on the fly", without writing in the filesystem.
You could use cStringIO for writing the file in memory but in reality it 
really
does not matter from the point of speed. Using a file offers you the 
possibility
to emit it through a FileStreamIterator. This avoids that you need to load 
the file
as a whole into the memory.

-aj

pgpdzU5KjOCtf.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Generating and Downloading PDF[Solved]

2005-05-13 Thread Fernando Lujan
Chris Withers wrote:
Um? What else is that method returning?
I'd suggest you call getrarTCE directly by URL, check you're setting 
the correct content-type and maybe set a content disposition too...

Solved. :) I create a External Method that returns the code.
I'm calling the external method using:
  
And I put the following lines at the end of the code:
fname stands for the filename
def generatePDF(page):
os.rename(_fname, "tces/"+_fname)
file = open("tces/"+_fname).read()
os.remove("tces/"+_fname)
page.setHeader('content-type', 'x-application/pdf')
page.setHeader('content-length', str(len(file)))
page.write(file)
This was the best solution that I could thought, once reportlab didn't create PDF 
"on the fly", without writing in the filesystem.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )