Many thanks for response Paolo!

I have tried your suggestion...


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

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



but the behaviour appears identical to the original code (commented out 
above)...

   - 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 
fixed. 

If I understand it correctly I believe that, 

response.stream (....,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"' % 
rcpt_filename


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?


Regards
Peter 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to