Hi Niphlod,

It worked! No need for StringIO. I just returned the blob field as the http 
response content. The code:

def pdfdoc():
    evento = session._eventos[int(request.args(0))] or 
redirect(URL('eventos'), args=request.args(0))
    response.headers['Content-Type'] = 'application/pdf'
    response.headers['Content-Disposition'] = 'attachment; 
filename="teste.pdf"'
    return evento['lb_documento']  #lb_documento is a blob field in an 
Oracle DB, mapped with a 'blob' type with DAL

BUT (always have a but!), the blob content (PDF) seems to be encoded. When 
I open the resulting downloaded file it is not recognized as a PDF file. I 
put a print just after retrieve the field from DB and it seems enconded 
(base64?). But it´s another problem.

Fred

Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
Pereira escreveu:
>
> Hello,
>
> Is there a way to return PDF content generated from a blob db field? 
>
> My table has a blob field whose content is PDF. I would like to create a 
> 'PDF page' from those bytes and return it.
>
> Thanks,
>
> Sorry for possible duplication.
>
> Fred
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to