Many thanks for response Paolo!

I have tried your suggestion...

# pdf.output(rcpt_filepath,dest='S')
# response.headers['Content-Type'] = 'application/pdf'
# return, chunk_size=4096, request=request, 
attachment=True, filename=rcpt_filename)

s_io = pdf.output(dest='S')
response.headers['Content-Disposition'] = 'attachment; filename="%s"' % 
raise HTTP(200, s_io, **response.headers

but the behaviour appears identical to the original code (commented out 

   - browser page doesn't change (Good!)
   - opens the File Open/Save dialogue for downloading the PDF (Good!)
   - also automatically opens the PDF in Adobe (Not Wanted!)

Without setting the 'Content-disposition' the pdf will be opened in the 
> browser.

Apologies if it wasn't clear but this particular issue had already been 

If I understand it correctly I believe that, (....,attachment=True, filename=rcpt_filename)

i.e. the assignment of the headers 'attachment'  and 'filename',  is 
functionally equivalent to  

response.headers['Content-Disposition'] = 'attachment; filename="%s"' % 

To summarise the issue, 
It is sufficient that the user is prompted to download and save the PDF - 
and this is working!. 
The only change that is needed now is how to prevent Adobe automatically 
opening the PDF as well?


- (Documentation)
- (Source code)
- (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 
For more options, visit

Reply via email to