J Cameron Cooper wrote:

> It's easier to guess when you say what the problem is.

I do see some funny indentation down at the bottom.

OK, it's happen because I paste the code inside a html message, than it's happen.

The following code is working. But I still have a problem. The browser ( firefox ) don't reconize the generated document as a PDF.

I'm calling this external method through a <dtml-var "gerar_tce_pdf()"> tag, inside a DTML DOCUMENT.

def gerarTCE(self):

        from reportlab.pdfgen import canvas
        import string
        import os       

        c = canvas.Canvas("hello.pdf")
        c.drawString(100,100,"Hello World")
        arquivo = open("hello.pdf").read()
        R = self.REQUEST.RESPONSE
        R.setHeader('content-type', 'application/pdf')
        R.setHeader('content-length', str(len(arquivo)))

Thanks for helping... :)

Fernando Lujan
Zope maillist - Zope@zope.org
** 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