On Thu, Nov 17, 2005 at 10:02:12AM -0500, Asad Habib wrote:
> Actually, I not receiving an error anymore but a pdf is not being 
> generated either. When I test my External Method directly through the 
> ZMI the only thing that is returned is the following line:
> 
> <__builtin__.html2pdf instance at 0x4a1e8f0>

Well, that's not unexpected :)  Your external method returns
an html2pdf instance, and that's exactly what you see here
- as a string.

If you want this method to return an actual viewable PDF,
you need to find some method of getting the actual PDF data
out of the object, and return *that*.

Or better, if the PDF is large, hopefully html2pdf has
some way to read data from it in chunks. Then you can do
something vaguely like (subsituting appropriate method calls):

    response = REQUEST.RESPONSE
    response.setHeader('Content-Length', your_pdf_object.get_size())
    response.setHeader('Content-Type', 'application/pdf')
    for data in your_pdf_object.read_data_by_chunks():
        response.write(data)

This will get data to the client faster, and maybe save memory
on the server depending on how html2pdf works.

-- 

Paul Winkler
http://www.slinkp.com
_______________________________________________
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 )

Reply via email to