On Tue, 2004-03-23 at 13:44, Pascal Francq wrote:
If I use reportlab within a Python module in Zope, how should I make the 
interface between Zope and Python function:
1°) Creating a local file in the python function and returning a string which 
will be used to create a anchor tag.
2°) Something more special, like returning a canvas object which can be handle 
by Zope as a normal Zope object.

I use "reportlab" to generate PDF reports with Zope in two ways :
  1. create a PDF file which is stored in the ZODB ; the result of the method call is then a redirection to the given file ;
  2. create a PDF file "on the fly" which is not stored in the ZODB and is returned directly in the response stream.

In these two ways, the Python method generates a complete PDF document (my documents are based on BaseDocTemplate with custom Flowable subclasses) in the form of a string : this string can then be used to create a file or returned "as is" in the response.

I can send you some examples if you want.


  Thierry




On Tuesday 23 March 2004 12:23, David Convent wrote:
> Pascal Francq wrote:
> >Hi,
> >I want to generate PDF document from within Zope. What is the easiest way
> > to do it? I know there is a python package (reportlab) which provides
> > functions to create PDF documents, but I am not sure it is the right
> > solution for Zope.
>
> as far as i know, it is the right solution